Hi All,
I confirmed that windows remote management is enable...
I wanted to create a script to remove software to one of the machine in AD environment but after run my script is nothing happen...
My scrip as below:
Import-Module ActiveDirectory
$Compt= Read-Host "Please enter the Computer Name/ IP Address that need software uninstall"
$compt1= Get-ADcomputer -filter 'name -like $compt' | select -expand name
$compt1
$soft = Read-Host "Please provide the software name you wanted to uninstall (example: Winzip)"
$soft2= "*$soft*"
$soft3= Get-WmiObject -Class win32_product -comp $Compt| Where {$_.Name -like "$soft2"}
$soft4= $soft3 | FL Name, Vendor,version, LocalPackage
"Please confirm the software you wanted to uninstall:"
$soft4
$confirmed= Read-Host "Please copy (right click -> mark -> enter to copy) and paste the local package to proceed uninstallation"
$arguments = '/x' + $confirmed + "/passive"
$uninstall= Invoke-expression "msiexec $arguments"
Invoke-command -computername $compt1 -scriptblock {$uninstall}
If I remove last 3 line and replace by below command that it works on my own machine but won't work on other remote machine:
msiexec /x $confirmed /passive
Please feel free to contact me at kaeinan@yahoo.com


