5

私は現在、WES 7 デバイスにインストールされているプログラムの多数のアンインストールを含むスクリプトを作成しています。アンインストールする必要があるアプリケーションの 1 つ (VMware Horizo​​n View Client) が再起動を要求します。これがスクリプトの一部である場合、既定のボタン (YES) を受け入れるように見え、デバイスの再起動に進みます。したがって、スクリプトは失敗します。

この再起動が行われないようにする方法について、ご協力をお願いいたします。

参考までに: このスクリプトは管理ツールを介して送信され、ターゲット上で昇格された方法で実行されます。

これは私のスクリプトです:

set-executionpolicy unrestricted
#############################################################
# Un-install unwanted applications
#############################################################
$application = Get-WMIObject Win32_Product -filter "Name='ThinPrint Client Windows 8.6'"
$application.Uninstall()
$application = Get-WMIObject Win32_Product -filter "Name='2X Client'"
$application.Uninstall()
$application = Get-WMIObject Win32_Product -filter "Name='Adobe Reader X (10.1.4)'"
$application.Uninstall()
$application = Get-WMIObject Win32_Product -filter "Name='VMware Horizon View Client'"
$application.Uninstall()
$application = Get-WMIObject Win32_Product -filter "Name='VERDE VDI User Tools'"
$application.Uninstall()
$application = Get-WMIObject Win32_Product -filter "Name='vWorkspace Connector for Windows'"
$application.Uninstall()

#############################################################
# Remove Internet Explorer Access
#############################################################
dism /online /norestart /Disable-Feature /FeatureName:Internet-Explorer-Optional-x86

#############################################################
# Remove IE Browser LNK from Taskbar
#############################################################
del "C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Launch Internet Explorer Browser.lnk"

#############################################################
# Make Citrix Receiver the shell
#############################################################
Push-Location
CD 'HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon'
New-Itemproperty -path .\ -name Shell -Type String -Value 'c:\program files\Citrix\Receiver\receiver.exe'
Pop-Location

set-executionpolicy restricted
# End of Script

スクリプトの途中で再起動を防ぐ方法について、いくつかの助けをいただければ幸いです。

4

1 に答える 1

10

Win32_Product を使用しないことを強くお勧めします。Win32_Product が呼び出されるたびに、各インストールのソフトウェア整合性チェックが行われます。これにより処理が非常に遅くなるだけでなく、問題が見つかった場合にソフトウェアの修復がトリガーされることもあります。

http://gregramsey.net/2012/02/20/win32_product-is-evil/

代わりに、レジストリに移動して、アンインストール文字列を呼び出します。

http://support.microsoft.com/kb/247501

msiexec の norestart フラグを使用して、再起動を防止することができます。

http://msdn.microsoft.com/en-us/library/windows/desktop/aa372024(v=vs.85).aspx

于 2013-07-25T20:48:06.720 に答える