小编J W*_*J W的帖子

在继续操作之前,如何让PowerShell等到命令完成?

我正在使用以下行根据其产品ID卸载office 2007

Start-Process C:\Windows\System32\msiexec.exe -ArgumentList "/uninstall {90120000-0030-0000-0000-0000000FF1CE}"
Run Code Online (Sandbox Code Playgroud)

我想在卸载完成后强制重新启动,但是使用-Wait或将结果传递给Out-Null不要等到卸载完成后再处理下一行重启.我也尝试使用cmd卸载但结果相同.

cmd /c "msiexec.exe /uninstall {90120000-0030-0000-0000-0000000FF1CE}"
Run Code Online (Sandbox Code Playgroud)

在处理Restart-Computer命令之前,有没有办法强制PowerShell等到卸载完成?我想可能会写一些东西来检测setup.exe进程何时停止然后再继续重启?

powershell powershell-2.0

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

作为登录脚本运行时,PowerShell 中的 cmdkey 不起作用?

尝试在 PowerShell 登录脚本中使用 cmdkey 将凭据存储在凭据管理器中。当脚本从 PowerShell ISE 运行时,一切正常,但当它通过组策略作为登录脚本运行时,除 cmdkey 之外的一切都正常。我一生都无法弄清楚为什么 cmdkey 可以在任何地方工作,除了在登录时运行脚本时。

# Checks if CRM for Outlook is isntalled by checking the folder path
$installed = Test-Path "C:\Program Files (x86)\Microsoft Dynamics CRM"
# Checks if the CRM has already been configured using the CoreConfigured registry entry
$configured = Get-ItemProperty -Path HKCU:\software\Microsoft\MSCRMClient -Name     "CoreConfigured"

# If CRM is installed and not configured, configure it, if CRM is not installed or     installed and configured, exit
If ($installed -eq "True" -and $configured.CoreConfigured …
Run Code Online (Sandbox Code Playgroud)

powershell

5
推荐指数
1
解决办法
8167
查看次数

标签 统计

powershell ×2

powershell-2.0 ×1