My Profile Photo

duffney.io


DevOps Engineer | Pluralsight Author | Speaker | Blogger | PowerShell Advocate


  1. Setting up an HTTP Pull Server for DSC

    Applies to: Windows PowerShell 5.0 In this blog post, we’ll be walking through how to setup and configure an HTTP pull server for Desired Stat Configurations. HTTP is only one of the three pull methods, the other two are SMB and HTTPS. It is not recommended you setup HTTP for production, but will work for a Lab without having to configure PKI (public key infrastructure). Belows lists the steps we’ll take to accomplish setting up...…


  2. Disable ADComputer in Action

    Applies to: Windows PowerShell 3.0+ Cleaning up Active Directory isn’t something every organization does or does well, but it’s very important. For semi obvious reasons it’s best practice to disable computers after X amount of days and is part of any System Administrators job. The script in this blog post will help automate the disabling and moving of objects to a specified OU. This task is fairly easy to script out within a simple foreach...…


  3. Move all Members of an ActiveDirectory Group to being just Members with PowerShell

    Applies to: Windows PowerShell 3.0+ Recently my team and I discovered an Active Directory group that was causing token bloat within our environment. The reason was due to someone place 246 objects in the members of section of the AD group, when they should have been in the members section. Active Directory Administration tool makes removing them from the member of easy, but add them to the members section first not so easy. To solve...…


  4. Change System Center Configuration Manager Client Cache Size with PowerShell

    Applies to: Windows PowerShell 3.0+ The only way to set the Configuration Manager client cache size is by specifying it at installation. This was troublesome for me as I left it the default 5GB at install, but then was requested to deploy some AutoDesk packages that where of course over that 5GB limit. Knowing I could not rely on the end user to change their cache size, I knew I had to find a better...…


  5. Fix 0KB Driver Packages in System Cennter Configuration Manager 2012 with PowerShell

    Applies to: Windows PowerShell 3.0+, SCCM There is a known issue with System Center Configuration Manager 2012, where after importing or creating a driver package the size could be 0KB. The problem is, it causes a task sequence that is using the driver package to fail. Since the size is 0, it thinks that the driver package isn’t distributed to the distribution points. To resolve this you must perform the following actions in the console....…


  6. Run CMD Commands within a PowerShell Script

    Applies to: Windows PowerShell 2.0+ Sometimes when you enter commands into PowerShell they don’t execute the same way as they would in the command prompt. I ran into this issue with an uninstall string for a security software called Cylance Protect. The uninstall string looks like this: msiexec /Lvx* c:\Temp\MsiUnInstall.log /x {2E64FC5C-9286-4A31-916B-0D8AE4B22954} /qn When I executed it within the command prompt it ran as expected, however when executed in PowerShell it pulled up the msi...…


  7. Remove Blank Lines from Foreach Results

    Applies to: Windows PowerShell 3.0, Windows PowerShell 4.0, Windows PowerShell 5.0 While creating a script that gathers all the product codes of .MSI files in a directory, I discovered a problem. The variable that I had place them in was generating blank lines between my variables. Below is an example of the problem After not being able to Google the correct combination of works, I quickly posted this problem to the Spiceworks community to help,...…


  8. Compare Active Directory and System Center Configuration Manager Active Devices

    Applies to: Windows PowerShell 3.0+, SCCM The purpose of this script is to check a list of computers provided by a text file against Active Directory and System Center Configuration Manager to determine whether or not they are active. You might use this script if you manage System Center Configuration Manager and frequently need to validate devices that are active in both Active Directory and System Center Configuration Manager. To use this script we’ll need...…


  9. Stop All System Center Configuration Manager Application Deployments

    Applies to: Windows PowerShell 3.0+, SCCM In the process of migrating to a new System Center Configuration Manager installation, I was tasked with stopping all of the old Configuration Manager application deployments. I didn’t end up counting how many there were, but it was more than I was willing to manually remove! Which brings us to why I’m writing this blog post. When you use the Remove-CMDeployment cmdlet in PowerShell you need two pieces of...…


  10. Rename Enable and Reset the Local Administrator Account with PowerShell

    We all know it’s not best practice to leave the local administrator account named administrator, for that reason most of us rename it. So why not save a little time while doing it? Below lists a simple PowerShell script that will rename the account enable it and reset the password. I’ve gotten a little tricky with the password and added the serial number as part of it. However that can easily be changed to whatever...…