PowerShell: Remove Files based on date

I’ve had the need to remove a bunch of differential backup images from my backup server for a short while now – and thought this was the perfect opportunity to crack into powershell. I’m going to post the script and run through the important parts: dir C:BACKUP -recurse -exclude SERVER1,SERVER2,SERVER3,SERVER4,SERVER1.IMG,SERVER2.IMG,SERVER3.IMG,SERVER4.IMG,FileClean.PS1 | where { ((get-date)-$_.creationTime).days -ge… Read more

Changing Company Wide AD mapped Home Drives

This is a quick and easy way to change all of your users mapped home drives without manually editing every user. This is really helpful if your migrating to a new file server. dsquery user “OU=XYZStaff,OU=XYZOU2,OU=XYZOU1,dc=XYZCorp,dc=local” | dsmod user -hmdrv Z -hmdir \XYZ-FileServerStaff$USERNAME$ Simply, the dsquery grabs all of the user accounts in the XYZStaff… Read more