我有一个 PowerShell 脚本来监视图像文件夹。我需要它在启动时自动运行。
我尝试使用 MSConfig,但在该列表中找不到它。
如何让脚本在启动时自动运行?
当我user以与服务器相同的身份登录时,我可以Enter-PSSession:
> Enter-PSSession -ConnectionURI http://xxx.xx.xxx.xx:5985
Run Code Online (Sandbox Code Playgroud)
但是,当我以不同的用户身份(在同一台机器上)登录并尝试Enter-PSSession使用-Credential参数时:
> Enter-PSSession -ConnectionUri http://xxx.xx.xxx.xx:5985 -Credential user
Run Code Online (Sandbox Code Playgroud)
输入密码后,我得到:
Enter-PSSession : Connecting to remote server xxx.xx.xxx.xx failed with the
following error message : Access is denied. For more information, see the
about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ConnectionUri http://xxx.xx.xxx.xx:5985 -Credential user
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (http://xxx.xx.xxx.xx:5985/:Uri
) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
Run Code Online (Sandbox Code Playgroud) 我想定期添加和删除主机文件条目。我相信最简单的方法是 powershell 和任务调度程序。
那么如何添加/删除主机文件条目呢?
在 Windows Server 2012R2 环境中,PowerShell cmdlet 是否可撤销rm?Remove-Item的 TechNet 手册指出它删除一个项目(多种类型),但没有说明取消删除该项目的可能性。
所以,如果我这样做
rm .\filename.ext
Run Code Online (Sandbox Code Playgroud)
从 PowerShell 提示中,我可以仅使用本机工具恢复此文件吗?
这是我在powershell中运行的命令
gwmi win32_process |select ProcessID,ParentProcessID,CommandLine,@{e={$_.GetOwner().User}}
Run Code Online (Sandbox Code Playgroud)
这是输出的部分列表
ProcessID ParentProcessID CommandLine $_.GetOwner().User
--------- --------------- ----------- ------------------
0 0
4 0
236 4 SYSTEM
332 320 SYSTEM
384 320 wininit.exe SYSTEM
392 376 SYSTEM
420 376 winlogon.exe SYSTEM
476 384 SYSTEM
484 384 C:\Windows\system32\lsass.exe SYSTEM
544 476 C:\Windows\system32\svchost.exe -... SYSTEM
Run Code Online (Sandbox Code Playgroud)
我想知道如何获得完整的命令行?(未截断如上图所示)
我需要捕获输出以在sensu插件中进行处理,该插件本质上是一个 ruby 脚本
我是制作批处理文件的新手。我正在尝试运行一个命令,该命令将在特定目录中打开 Windows PowerShell,然后在那里运行一个命令。
到目前为止,我有以下内容。Powershell.exe -noexit -command "cd 'c:\Dev\ProductDev'"这似乎可以将 PowerShell 打开到正确的位置,但我无法让它运行命令node sp。
我尝试了以下但没有成功 PowerShell -NoExit -Command "Write-Host 'node sp'"
另外,是否可以让它在蓝色显示屏幕而不是 CMD(黑/白)窗口中打开 Windows PowerShell?
查找在 Exchange 2010中启用了“外出”的用户介绍了如何使用 PowerShell 确定用户是否启用了他/她的外出设置。但是,它需要使用Exchange 命令行管理程序。
有没有办法在不安装(附加)依赖项的情况下做到这一点?
我的问题是 WinRM 是否可以安装在 Windows 10 上,因为页面上说:
安装 WinRM
如果您的操作系统尚未安装 WinRM,您可以在以下下载中找到它。
注意 选择下载时,请仔细查看下载页面上的系统要求,了解操作系统和应用程序兼容性。
•Windows Management Framework 4.0
•Windows Management Framework 3.0
•Windows Server 2008 的
Windows PowerShell 2.0 和WinRM 2.0
• Windows Server 2008 x64 版的Windows PowerShell 2.0 和WinRM 2.0 •Windows Server 2003 的
更新(KB968930) •Windows Server 2003644 的更新版本 (KB968930)
•适用于 Windows Vista 的
Windows PowerShell 2.0 和 WinRM 2.0 •适用于基于 x64 的系统的Windows Vista 的Windows PowerShell 2.0 和 WinRM 2.0
假设我有以下命令:
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -u user --password=pass dbname < backup.sql
Run Code Online (Sandbox Code Playgroud)
它cmd在 PowerShell 中运行良好,但在 PowerShell 中我得到以下信息:
At line:1 char:53
+ "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -u user --password=pass dbna ...
+ ~~
Unexpected token '-u' in expression or statement.
At line:1 char:56
+ "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -u user --password=pass dbna ...
+ ~~~~
Unexpected token 'user' in expression or statement.
At line:1 char:84
+ ... rd=pass dbname < backup.sql
+ ~
The '<' operator is reserved for future …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的 Windows 10 64 位机器上打开计算器应用程序。
当我在开始菜单中搜索 calc 并单击它时,出现错误
你需要一个新的应用程序来打开它
我尝试使用此命令重新注册我的 Windows 10 应用程序
Get-AppXPackage | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Run Code Online (Sandbox Code Playgroud)
以管理员身份运行powershell,仍然出现同样的问题。
我该如何修理我的计算器?
powershell ×10
command-line ×3
windows ×3
windows-8.1 ×2
autostart ×1
batch ×1
exchange ×1
hosts-file ×1
mysql ×1
script ×1
windows-10 ×1