PowerShell Add Variables to Machines from CSV SCCM ConfigMgr

So it used to be a bit trickier to add a custom variable or multiple variables to a machine object in SCCM/ConfigMgr. But since the addition of the awesome New-CMDeviceVariable Cmdlet it’s a breeze!

Basically I’m in the midst of automating a clients Server Builds. As they have a lovely spreadsheet with all details of each server I thought I’d nock this up as a starter this evening.

So the script imports the CSV specified and from there creates the variables supplied in the CSV to the machine that is named in the CSV (that’s a lot of CSV). If the script cant find the Machine object (say you are doing hundreds or thousands!) that is named in the CSV file it will log that name to a text file called “NotFound.txt” in the script root folder.

As always comments throughout the script explain every step.

Anyway here is the script and CSV example:

CSV:

PowerShell Export Collection Members to CSV SCCM ConfigMgr

I was at a client’s yesterday and wanted to “True Up” SCCM/ConfigMgr’s Collection memberships compared to a spread sheet they had of their servers. Now I’m not an Excel wizard by any stretch of the Imagination! So the client said “Can you get me a CSV with the server names listed”.

The next thing that happened is bellow! It’s really quite a simple script when you think about it. As always comments throughout the script explain what is happening.

Anyway here it is:

PowerShell Check Power Adapter Connected Upgrade UEFI/BIOS – SCCM Application

The other month I was asked by one of my clients to deploy a BIOS/UEFI upgrade to the HP Elite x2 1012 G1. Now this as we all know is fine and very normal, the only issue I had was ensuring that the Power adapter was connected before running the BIOS/UEFI upgrade. This is because.. when you use the force switch on the HP upgrade utility it does not check for the Power Adapter state and also bypasses low battery and will install regardless.

So I created a script….

This script is designed to be run with the BIOS/UEFI upgrade package within.

  1. It will check first the Hardware type of the device (2 being Laptop, 1 being Desktop) making sure it is a mobile device.
  2. The script will then check the WMI property “PowerOnLine” to establish whether or not the power adapter is connected.
  3. If the Power Adapter is connected it will continue with the BIOS/UEFI upgrade (Jump to step 5)
  4. If the Power Adapter is not connected  it will warn the user 10 times before closing and informing the User to Re-Run the application from Software Center when power is available. (Warning count is customizable)
  5. The script will then identify the BIOS/UEFI version and if it is less that the version being deployed it will then warn and install the new BIOS/UEFI version.
  6. The script also does error checking around the Model of the machine.

Anyway enough already… Here is the script. As always feel free to use it but don’t forget where you got it from!

Get Current or old Machine Name from WinPE VBScript

This script was designed to get the current or old computer name from WinPE and apply it to the Task Sequence Variable OSDComputerName.

It has been written in VBScript to not require PowerShell in the boot image.

Here is the script:

Copyright 2016 SCCMOG | All Rights Reserved