I know, finding the “maximum” MTU is a redundancy, as MTU is an acronym for “Maximum Transmission Units”. However, my needs were to find all the MTUs to each hop of a tracert. Like many scripts, Find-MaxMTU.ps1 turned out to be a cut and paste exercise. I started with the Find-MTU script written by Robin CM. …
Author: Alan
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…
Quickly Check Domain Controller Health
How can you tell whether an Active Directory domain controller is functioning properly? How do you know whether some over-zealous VLAN ACL is blocking necessary ports? Testing ICMP, is easy, just ping it. Testing LDAP response isn’t hard, I wrote a vbScript to do that years ago. But to complete, we want to check more. …
CIM_DATETIME Conversion Functions
Also known as WMI Time, or WBEM DateTime, CIM_DATETime, https://msdn.microsoft.com/en-us/library/aa387237(v=vs.85).aspx, is that odd Windows DateTime format that shows values looking like “20160905103517.816236-240” The COM Object that presents this is WbemScripting.SWbemDateTime, and you frequently see code to convert to this format using it, or a tortuous series of string manipulations. My rule of thumb is this: …
Get All the Groups for A Users
Every admin has gotten the question, “What group is that user in which granted him those permissions?” I have combined a few scripts to create a list of all of a user’s groups, and included the nesting of groups memberships. Get-ADGroupMemberships.ps1 is based on a script by I.C.A. Strahan, here. My version adds information about…
WMI Repair — The Old Way is a Bad Way
This was forwarded to me from one of our Microsoft guys. I have been using a batch file to fix WMI with this line for years: WMI: Stop hurting yourself by using “for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s”
Move Selected Item Up or Down in PowerShell Listbox
Listbox Move Up Down Buttons.ps1 shows the event handlers for moving a selected item up and down in a PowerShell listbox. I wrote it because couldn’t find it anywhere else. $handler_DownButton_Click= { #only if the last item isn’t the current one if(($ListBox1.SelectedIndex -ne -1) -and ($ListBox1.SelectedIndex -lt $ListBox1.Items.Count – 1) ) { $listbox1.BeginUpdate() #Get starting…
A GUI to Select Object Properties in Pipeline
My first attempt at a GUI to select objects properties demonstrated that I didn’t have a firm grasp on how to pipeline an object through an advanced function. The problem I had at the time was not understanding how to have the form only appear once. Why is that difficult? Because the Begin Block won’t…
Copy Distinguished Name of OU to Clipboard (OUADSPath2Clip Updated)
OUADSPathToClip.ps1 is an updated version of OUADSPath2Clip.ps1 and is an example implementation of the new Select-OU.ps1 script. Fast navigation of OU structure to copy the OU’s DistinguishedName into your clipboard. Version 1.1 allows control of form and button text.
A Reasonably Fast Select AD Object PowerShell Form
Like Select-ADOU.ps1, the Select-ADObject.ps1 PowerShell Script begins by finding the AD Forest, and enumerating all domains. The user’s current domain is set as the default, and the first level of the domain is automatically expanded and put into the TreeView. This expansion of the first level is done with any domain selected. Double click on an node…