Fix-HomeDrivePerms.ps1 is a PowerShell script which attempts to reset folder security when the permissions are really hosed. It uses a take ownership function, Set-Owner, by Boe Prox, instead of takeown.exe, but does shell out to iCacls.exe. I wrote this to fix home directories where a user might be logged on with files open a the…
Tag: Powershell Scriptlets
Consolidating Data For Report: Getting from Group-Object to CSV
I am working on some scripts which show AD domain controllers by their site. My goal was to have the data combined so that each site has a single row, with the server name and IP address for each site being shown joined by semi-colons. None of the examples for…
Function to Get Splat Parameters from a CSV File
Splatting is the use of a hash table to pass parameters to a PowerShell script. As PowerShell scripts grow in complexity, you may want to pass a large number of parameters multiple times, for scripts which spin up a lab environment, or for Desired State Configuration. It took me a while to figure out how…
Suggesting a default filename
I like to leave log files where people can find them. Typically this is on their desktop, or in the same folder where the script ran from. I wrote the following bit of code which creates a date based report file and offers it as a default. It is pretty straightforward, but I did not…