Drive defragmentation is not a very exciting subject, however in the past I’ve had a need to automate drive defragmentation via a scheduled task so I’ve used the following VB script. It … [Keep Reading]
Author: dkegg
Removing a proxy address from an NT Account
Occasionally it might be necessary to remove one or more items from the ProxyAddresses array in AD, this array contains all the SMTP addresses stamped on the AD object. Here’s a VBScript … [Keep Reading]
NT Account to SID translation …. and back again.
I keep the following nifty functions in my Powershell profile, it helps when working with SIDs and Active Directory, it allows you to easily convert a SID back to the NTACCOUNT … [Keep Reading]
Group Nesting Powershell report using Quest Activeroles
I was recently asked to provide a report on the number (and depth) of nested groups in AD.
Getting a list of the groups inside a group is pretty simple using … [Keep Reading]
Zipping files older than X days
Recently I was working with a firewall that wrote some tremendously large log files and was eating disk at an alarming rate, so to remedy this, and sharpen my Powershell pencil, … [Keep Reading]
Powershell and Hyper-V Management
There’s an awesome tool on codeplex for managing Hyper-V using Powershell called PSHyperV, it’s especially handy if you’re working with Hyper-V on a Windows Server Core installation.
Just download the … [Keep Reading]
Powershell Remote User Logoff / Reboot
When patching servers, any disconnected user sessions typically prevent the post-patch auto reboot. To remedy this you could use the following Powershell script :
foreach ($_ in get-content servers.txt) {(… [Keep Reading]
Merging and appending to CSV files using Powershell
The time-tested approach of appending data to the end of a file using >> doesn’t necessarily work with CSV files in Powershell, and Out-File with the -append switch typically results in a … [Keep Reading]
Powershell – Deleting files X days old
Here’s a powershell script you can use to delete files in a directory (and all sub-directories) X days old or older.
$Now= Get-Date
$Days = “3“
$TargetFolder =… [Keep Reading]
Creating secondary proxy addresses
Often times it may become necessary to stamp an additional SMTP address (proxy address) on a user account, either as part of a migration, or organizational domain name change etc…
Here’s a … [Keep Reading]