I had some trouble getting the deployment to work at first, but finally managed to get it going. Here are the steps I took written out just in case you may run into the same problem:
- Open up Powershell ISE on your computer, copy and paste the text below into the Editor pane (you may want to include the registry export line as well), and save it as a .ps1 powershell script file.
- In Group Policy Manager, create a new object, edit the object, go to Computer Config > Policies > Windows Settings > Scripts > Startup.
- Under the startup script window, go to the Powershell Scripts tab.
Here's where I tried two different implementations. One seemingly has worked for others but didn't work here. If you need, try them both in your testing.
Method 1: seems to work for others
- Under the Powershell Scripts tab, click 'Show Files' and paste the .ps1 file you created into the Startup directory.
- Back under the Powershell Scripts windows, click 'Add', choose 'Browse', and select this .ps1 file that you just copied.
- In the 'Parameters' field, include "-ExecutionPolicy Bypass" to allow this script to run without having to change the execution policy in powershell.
- Test this GPO in a testing suborganization.
Method 2: worked for us
- Save the .ps1 file you created to netlogon, where computers would have permission to run it.
- Under the Powershell Scripts tab of the GPO editor, click 'Add', type "Powershell.exe" into the 'Script Name' field.
- Under Script Parameters, include "-ExecutionPolicy Bypass \\
\NETLOGON\ - Click OK and it's done.
Use both of these if you'd like. As long as one of them runs the script on the machine, it will work. Whichever deployment method works in your testing, the script itself will quietly uninstall Quicktime from computers in the active directory sub-organization in which you assign the policy object. This method will probably not work on XP computers as this script requires Powershell 3.0 or higher (I believe XP can only install Powershell 2.0).
There are probably several ways to perform remote software uninstallation like this, but this method worked well for us here. Please share if you have any other methods.
Powershell Script:
#reg export HKLM\SOFTWARE\Microsoft\ Windows\CurrentVersion\ Uninstall C:\exportedkey01.reg
#reg export HKLM\SOFTWARE\Wow6432Node\Micr osoft\Windows\CurrentVersion\ Uninstall C:\exportedkey02.reg
$qtVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\ Windows\CurrentVersion\ Uninstall, HKLM:\SOFTWARE\Wow6432Node\ Microsoft\Windows\ CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object {$_.DisplayName -match "quicktime" } |
Select-Object -Property DisplayName, UninstallString
ForEach ($ver in $qtVer) {
If ($ver.UninstallString) {
$uninst = $ver.UninstallString
$uninst = $uninst -replace "/I", "/x "
Start-Process cmd -ArgumentList "/c $uninst /quiet /norestart" -NoNewWindow
}
}
No comments:
Post a Comment