Posts Tagged PowerShell

May 2 2017

Get List of User Profile Folders (PoSH)

The following snippet of PowerShell will collect the list of profiles active on a system from the registry and populate an array.

I remove any profile folder that does not exist, as well as any that are within the Windows folder (e.g. NetworkService, LocalSystem), but you can modify as you see fit if that doesn’t meet your needs. I use this when I need to add files, remove files, or make changes to files within a users profile.

You could just loop over C:\USERS\ subfolders and be fine 9,999/10,000 times, but this covers those circumstances where profiles have been stored elsewhere, where C: is not the drive with the profiles, or when you need to make sure you’re not modifying folders that aren’t true profiles.

Apr 25 2017

Remove Recent Printers from Chrome Preferences File (PoSH)

Chrome does not remove “Recent Printers” from the print option box when a user or an administrator deletes a printer from the machine. This can cause problems when a printer is removed by policy or is updated with a new print server name, but a user continues totry and print to the old server. This script will remove the printer from the PREFERENCES file. You can provide no printer list and all Recent Printers will be removed, or you can specific a specific printer.

Oct 27 2015

PowerShell Script to Report SCCM DP Disk Space

I wrote the following script to quickly output how much disk space my SCCM Distribution Points consumed.  If you’re not running a CAS, you’ll want to change line 21 to point to your primary.  This requires that you have the Configuration Manager console installed on the machine.

It’s not pretty but it did the trick.  I’m certainly open to suggestions in the comments.


Oct 2 2015

PowerShell Script to Output GPO Versions across DCs

I wrote the following PowerShell script so that I could easily watch my GPO changes replicate around the globe, letting me know when I could have someone at a specific site update policy when new policies or changes were rolled out. To use, just replace $gpoGUID = “{12345678-1234-5678-9123-ABCDEFEDCBA0}” with the GUID of the policy you want to check on.  You can find the GPO GUID in the properties of the GPO and on the details page in the Group Policy Management Console.


Jul 28 2014

Deleting Inactive AD Computers from SCCM 2012

I wrote the following script to find inactive computers in Active Directory and then find & delete them from SCCM. Feel free to use & abuse as you see fit, but always run through a test environment first. My version makes sure to target only Windows Operating Systems, and excludes anything with Server in the caption – you’ll want to adjust the filter as needed in your specific environment.