Script to remove files/folders from all local profiles

I had a requirement recently that required a folder and all files under it to be removed from all local user profiles on a machine – turns out this is really simple to do in powershell: # Get a list of all local profiles on the target machine # $users = Get-ChildItem c:\users # Now …

Read moreScript to remove files/folders from all local profiles

WSUS Reset and Re-Authorize

Recently I came across ¬†a customer site where a lot of the machines had stopped receiving updates from WSUS, despite being visible in the WSUS console and having shown as reported in. I decided to write a powershell script to parse all the machines in AD, stop the Windows Update service, delete the SoftwareDistribution folder, …

Read moreWSUS Reset and Re-Authorize

Windows Password Roll Script GUI

Back in may 2014, Microsoft released a patch to fix a vulnerability in Group Policy Preferences¬†which left many people without a method for changing local account passwords. Happily, they also provided a powershell script to allow sys admins to do this. Whilst the script works, it isn’t very elegant or user friendly, indeed one of …

Read moreWindows Password Roll Script GUI

How to unzip files in powershell

function Expand-ZIPFile($file, $destination) { $shell = new-object -com shell.application $zip = $shell.NameSpace($file) foreach($item in $zip.items()) { $shell.Namespace($destination).copyhere($item,16) #16 answers Y to any prompts, eg overwrite } } #call the function so: Expand-ZIPFile -file “c:\myfile.zip” -destination “d:\somedestination”   Amazon Auto Links: No products found.