Add-ADTSInfo.ps1 adds TerminalServicesHomeDrive, TerminalServicesHomeDirectory, TerminalServicesProfilePath and AllowLogon as additional members returned by a query of Active Directory user objects. As you may know, when looking at a user’s properties in the Active Directory Users and Computers MMC there is a tab for these fields. However, if you look at the properties of a user object, these…
Tag: PowerShell
Combine CSV Files to XLSX File with Worksheets
Three years ago, I posted CombineXLSheets.vbs, a vbScript which allows you to drop and drag Excel spreadsheets onto it and have them combined into a single workbook file with multiple worksheets. Now that I am working in PowerShell, I have found the need to consolidate CSV files. Parts of Combine-CSVFilesToWorksheets.ps1 come from code ported from…
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…
Convert System.DirectoryServices.SearchResult to a PSObject
The ADSI accelerator is fast, and built into PowerShell, unlike the Active Directory Module. When use it, or the ADSISearcher, you have results which look like this [Image from previous Microsoft URL]: Getting the properties out to a file can be tricky. I wrote two little functions to make this easier: Function ConvertTo-PSObjectFromDirectorySearchResult($oDS){ $outval =…
Get COM Object Constants with PowerShell
I avoid using COM objects whenever I can. One of the annoyances is that you need to look up the value of constants. Shay Levy, in http://www.powershellmagazine.com/2013/03/20/pstip-working-with-excel-constants/ has a script which demonstrates how to enumerate the constants for the Excel COM object. Get-COMConstants.ps1, is an advanced function generalization, which can be used for any COM…
Remove DNS Host Record and PTR with PowerShell
You have been asked, “Please remove the host record for these 15 computers, plus their associated PTR records”. It isn’t a difficult task, but it can be time consuming, especially if you have a large DNS database. The in-addr.arpa bit can be annoying to do over and over again. When I first decided to automate…
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. …
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.
Fast PowerShell Treeview OU Selection Form
A large number of my scripts involve picking an Active Directory Organizational Unit (OU). I have been using Out-Gridview for OU navigation. This is because I was unable to find a form based GUI OU picker that worked fast enough in my very large AD environment. The scripts I have seen tended to collect all objects at…