标签: powershell

以非管理员身份远程处理 Powershell

我正在使用ssh登录到其他 Windows 机器。我正在尝试pssessionlocalhost. 但我不能在正常的豪华提示下做到这一点:

$ New-PSSession
New-PSSession : [localhost] Connecting to remote server localhost failed with the
following error message : Access is denied. For more information, see the
about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession
+ ~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspa
   ce) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Run Code Online (Sandbox Code Playgroud)

看来我必须在一个高架的豪华外壳上。没有管理员权限,有没有办法做到这一点?

ssh powershell windows-8

4
推荐指数
1
解决办法
8876
查看次数

有没有办法更改 PowerShell 横幅消息?

每次启动 PowerShell(除非使用-nologo参数),都会出现 Microsoft 版权通知消息。

Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
Run Code Online (Sandbox Code Playgroud)

有没有办法修改此横幅以添加更多有趣和/或有用的信息(例如:PowerShell 版本、当前系统日期/时间、“您好 Falken 教授。我们玩游戏吗?”等)?

powershell

4
推荐指数
1
解决办法
8078
查看次数

如何让远程计算机在远程计算机本身上运行 PowerShell 脚本?

我有两台远程机器:1 我们称之为驱动程序,2 我们称之为客户端。它们在同一个域中,我们称它们为“TECH.com”。

在驱动程序机器上,我有一个 PowerShell 脚本来控制客户端机器: 1、在客户端上还原检查点。2、停止客户端。3、启动客户端。等等。我想做的事情是让客户端机器执行另一个 PowerShell 脚本(它可以驻留在客户端或/和驱动程序中。如有必要,我可以将文件从驱动程序复制到客户端)客户端机器。

于是我做了一些研究,发现了两种方法: 1、WS管理。2、WMI 我在两台机器上都启用了-psremoting。我已经在两台机器上测试了 WsMan,他们发现工作正常我已经能够在这两台机器之间传输文件但是,当我尝试运行 Invoke-command 时,它给了我错误:

Connecting to remote server XXXXXXtech.com failed with the following error message : WinRM cannot process the request. The following 
error with errorcode 0x80090311 occurred while using Kerberos authentication: There are currently no logon servers available to service the logon request.  
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specified.
  -Kerberos …
Run Code Online (Sandbox Code Playgroud)

powershell

4
推荐指数
1
解决办法
2万
查看次数

谁是 Windows PowerShell 的发明者

纯粹出于好奇,Windows PowerShell 的发明者是谁?正如我在每台 Windows 机器上看到的那样。那么有人可以让我深入了解 Windows PowerShell 的发明者是谁吗?

编辑
我已经阅读了帮助中心,并且确实意识到这有点偏离主题。如果您选择,该主题可能会保持锁定状态。

powershell

4
推荐指数
2
解决办法
1360
查看次数

Windows 防火墙规则的范围的 IP 地址数量是否有限制?

我有一个 Powershell 脚本,它将尝试在我的服务器上运行暴力攻击的 IP 地址添加到阻止他们访问它的防火墙规则中。最近它停止工作,并开始抛出此错误:

异常设置“RemoteAddresses”:“数组边界无效。(来自 HRESULT 的异常:0x800706C6)”

可以放入 Windows 防火墙规则范围的 IP 地址数量是否有限制?这是在 Windows Server 2008 R2 上运行的。

windows security powershell windows-firewall

4
推荐指数
1
解决办法
5461
查看次数

使用 PowerShell 设置 UAC 级别

我正在寻找一种使用 Powershell/命令提示符设置 UAC 级别的方法。我知道注册表中的“EnableLUA”值,但这不会设置级别。这只是真的或假的。

有没有办法用Powershell设置UAC级别?级别,我的意思是UAC的四个级别。它们从“从不通知”变为“始终通知”。

谢谢你。

windows-registry windows-7 uac powershell

4
推荐指数
2
解决办法
2万
查看次数

使用 PowerShell 在特定行之后添加行到文本文件

我必须在数百台计算机上远程编辑一个名为 nsclient.ini 的文件,该文件包含一些命令定义。例如:

[/settings/external scripts/scripts]    
check_event="C:\Program Files\NSClient++\scripts\Eventlog.exe" -e System -t Error
check_event_application="C:\Program Files\NSClient++\scripts\Eventlog.exe" -e Application -t Error
check_activedir=cscript "C:\Program Files\NSClient++\scripts\Check_AD.vbs" //nologo
Run Code Online (Sandbox Code Playgroud)

我需要在 [/settings/external scripts/scripts] 下面添加一个新行,这个新行不应覆盖下面的现有行。

谢谢你的帮助。

powershell command-line

4
推荐指数
1
解决办法
2万
查看次数

批处理中相当于“%~dpn0”的powershell是什么?

我是 powershell 的新手,我问自己如何将以下变量放入 powershell 脚本中?我知道如何在 powershell 中设置变量,但我不知道如何获取"%~dpn0".

set pgm=%~n0
set log=%~dpn0.log
set csv=%~dpn0.csv
set dir=%~dp0users
set txt=%~n0.txt
set fix=%~dpn0.fix
Run Code Online (Sandbox Code Playgroud)

powershell hard-drive batch

4
推荐指数
1
解决办法
5256
查看次数

如何删除名称中没有特定字符串的所有文件

我已经看到删除与特定模式不匹配的所有文件 - Windows 命令行

但是,我还没有看到有关如何删除文件名中包含特定字符串的所有内容的任何信息。

如何删除文件夹及其子文件夹中文件名中没有“MS”(区分大小写)的所有 zip(不应影响其他文件)文件。

这些字母可能与其他字母相邻(例如,应保留文件名“ABCMSABC”,因为其中包含“MS”,但应删除所有其他文件)。多个文件中将包含“MS”。

windows file-management powershell regex batch

4
推荐指数
1
解决办法
3836
查看次数

随机powershell.exe进程?

几天前我在任务管理器中注意到我有一个 powershell.exe 进程正在运行。当我去 msconfig 它有一个非常长的命令。这里是:

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -windowstyle hidden -executionpolicy bypass iex ([Text.Encoding]::ASCII.Get.String([Convert]::FromBase64string((gp'HKCU:\Software\Classes\SAJELFZIXHQTV').ADUXJH)));
Run Code Online (Sandbox Code Playgroud)

这真的很奇怪,因为就在今天,我之前遇到过问题的一个随机进程出现了(也许它与此无关,只是说)这是一种病毒,并试图在我的 PC 上下载不安全的驱动程序,正如 Windows 所说的那样。谁能告诉我有关此 PowerShell 进程的信息?它在启动时启动并且一直在运行。再一次,我希望我没有听起来很无知,也许这只是一个正常的启动过程。

windows security windows-7 powershell malware

4
推荐指数
1
解决办法
1516
查看次数