我目前正在編寫一個腳本,其中涉及到一些WES 7設備上安裝的程序的卸載。我需要卸載的一個應用程序(VMware Horizon View Client)要求重新啓動。當這是腳本的一部分時,它似乎接受默認按鈕(是)並繼續重新啓動設備。因此腳本失敗。Powershell卸載腳本 - 真的很頭疼
我真的很感謝你的幫助,以防止發生這種重新啓動。
僅供參考:此腳本通過管理工具下發並在目標上以高架方式運行。
這是我的腳本:
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
我將非常感謝如何防止通過腳本重啓中途一些幫助。