I support a number of hospitals. Many of these have very large facilities, where the placement of computers was originally done by a space planner or others trying to make an educated guess about how and where people would be working. Frequently we find that there are computers which are unused or only rarely used. …
Tag: PowerShell
Get Oldest Windows Event
Get-OldestEvent.ps1 is a PowerShell advanced function which returns the oldest event from a Windows computer event log, and will help you determine the rollover time for an event log by also returning the age of the record as a time span with the time created. Optionally you can return the entire oldest record with the…
Passwords for Password Resets
I discovered that my script to generate passwords, RandomPW.vbs, isn’t popular with users because the passwords are random. I have an even more complicated but unposted PowerShell version with the same issue. I wanted to create something that was easier for the help desk and users. Get-TempPW.ps1 is my answer to those objections. This script…
Get the Parent OU for an AD Object
I have mentioned before that the Charlotte PowerShell User group was frequented by Scripting Guy Ed Wilson, and his wife Teresa. I’m sad to say that they have moved away, but am happy that Brian Wilhite has been running the meetings since. I mentioned to Brian that I had a cool way to get the…
Test Whether Organizational Unit or Account Exists
Here are two quick functions which I have recently found useful. The first tests whether a user account exists. It takes the Domain and Identity as arguments. Using the “Stop” error action with Try/Catch keeps it from showing any errors. You can do this with any of the AD cmdlets, such as Get-ADOrganizationalUnit, Get-ADComputer and…
Skype and PowerShell – Toggle Mute, Export Participants
Updated September 2018. Note that this code works with Lync 2010 and Skype for Business, and that some of the scripts have been updated. I spend a lot of time in Skype (formerly Lync) conferences. There are two things about the Lync 2010 client which drove me nuts. The first is that there was no…
Export PowerShell script output to Text with Out-Notepad
Out-Notepad.ps1 lets you redirect the output of a PowerShell command or script into Notepad. There are a couple of interesting things here. In Line 23, I use [System.IO.Path] to get a random file name. In line 34 I use [Microsoft.VisualBasic.Interaction] to shell out to Notepad and wait for it to close before deleting the file….
Export DNS Server Records with PowerShell
I am frequently asked to export DNS records, such as, “Give me the list of A, MX and CName records in DNSZone1 and DNSZZone2”. Server 2012 has got some nice cmdlets, but I wanted something more universal with a GUI. Export-DNSEntries.ps1 uses a combination of Out-GridView and a custom from to allow you to pick…
Auditing Active Directory Permissions with Powershell
Active Directory permissions aren’t easy to audit. It is a lot easier to delegate permissions to a user or a group than it is to figure out later who has what rights on what containers and organizational units. I have taken a few runs at it, including a vbscript version which was terrible. That is…
A GUI Select of Properties for PowerShell Scripts
Updated Version, with pipeline support is here. I have been writing a number of reporting and audit scripts where there are a lot of potential properties that the user might want in the log file or report. It is hard to guess what items that they want in their report or in what order that…