Category Archives: Scripting

Practical Lessons on WPF Forms and PowerShell

Last weekend I decided that I was finally going to figure out how to stop using Windows Forms, and move to the newer Windows Presentation Foundation (WPF).  Some time ago, I had read a WPF blog post from FoxDeploy.com, which … Continue reading

Posted in Functions, PowerShell, Scripting, Scriptlets | Tagged , , | Leave a comment

Where am I? Getting the Name of the Currently Executing Function

I almost always debug scripts by stepping through them.  But sometimes it is nice to just have a way to write the current function during execution.   I use this:

This uses the .NET formatting style, where the contents … Continue reading

Posted in PowerShell, Scripting, Scriptlets | Tagged | Leave a comment

Two Ways to Get Mapped Drives with WMI

For years I have been getting mapped drives from WMI using Win32_NetworkConnection. Typical code looks like this in PowerShell:

I have been using a product called ExpanDrive to map my cloud storage to drive letters.  When I tried to … Continue reading

Posted in PowerShell, Scripting, Scriptlets, WMI | Tagged , | Leave a comment

Reset User Account ACLs

The security for user account objects in an OU may drift over time. User accounts moved within the domain will retain delegations previously made, and user accounts created after schema extensions won’t have the same security as user accounts created … Continue reading

Posted in Active Directory, Alan's Favorites, My Best, PowerShell, Scripting, Security, Windows Administration | Tagged , , | Leave a comment

Report GPOs with Script References

How quickly can you answer this question:  Which Group Policies reference batch files, vbscripts, or PowerShells?  What is the best way to get the information and present it into a spreadsheet?  I did it by searching SysVol for the script.ini … Continue reading

Posted in Active Directory, Group Policy Objects, PowerShell, Scripting, Windows Administration | Tagged , | Leave a comment

Using Workflows to Multithread AD Queries

I am frequently called on for Active Directory reports for all domains in the forest.  This code shows you how to use a workflow to easily do this, adding the domain data into the results:

Posted in Active Directory, Functions, PowerShell, Scriptlets | Tagged , | Leave a comment

Launch the Group Policy Editor Outside the MMC

It is annoying that there isn’t a command line for the Group Policy Editor.  To edit a GPO you must 1) open the Group Policy Management Console, 2) Open the list of Group Policies, 3) select the GPO you want … Continue reading

Posted in Group Policy Objects, PowerShell, Scripting, Windows Administration | Tagged | Leave a comment

Delete User Profiles Interactively with PowerShell

Last week, one of my administrators was complaining at how involved it was to remove a profile on a remote user’s computer. A little over two years ago, I wrote Delete Inactive Profiles, as a substitute for DelProf for post … Continue reading

Posted in PowerShell, Scripting, Windows 10, Windows 7, Windows 8, Windows Administration, WMI | Tagged , | Leave a comment

Getting GPO GUID, Name from Active Directory

You don’t have to rely on the Group Policy Module to resolve the display name of a GPO from the GUID, or the GUID from the display name.  Here are two short functions that will get that information from Active … Continue reading

Posted in Active Directory, Functions, Group Policy Objects, PowerShell, Scripting, Scriptlets | Tagged , , , | Leave a comment

Undelete-ADObject

Undelete-ADObject.ps1 is a GUI form based script for undeleting user, computer, group, print queue, and contacts from Active Directory.  You can display all of the objects of the selected type, or search by the name. I use this script frequently.  … Continue reading

Posted in Active Directory, Alan's Favorites, PowerShell, Scripting, Windows Administration | Tagged , | Leave a comment