Archive | PowerShell

Add devices from a text file to a SCCM 2012 Collection

There is many versions of this out on the Internet. But this is mine!

This script will add all the devices in a file to a specified Collection. Just save the script below to a file called “AddDeviceToCollection.ps1” and change the section marked as “Change this section”. After this just run the command as follow:

.\AddDeviceToCollection.ps1 -CollectionID PS100001 -File .\ComputersToAdd.txt

Code Example

 

0

Script for coping files that are not already at destination

This is a script for coping files from one place to another. It will only copy a file if the file at destination is not the same as the one at the source. The script will also create the folder structure at destination if it doesn’t exist.

Try it out by just running it at a PowerShell prompt or as a login script. The script can be downloaded here: “CopyFiles“.

 

 

0

Tiny script to get the Computer name and Serial number from SCCM 2012

This script will connect to the Configuration Manger 2012 database and read the database tables to get information about computer clients and their serial number.

The script also gives the opportunity to search for a computer name by adding the serial number as an input or the other way around, get the serial number by adding the computer name as input.

To run the script successfully you need access to the Configuration Manager 2012 database. The script is provided at the end of this blog post.

screenshot

Powershell Script: GetSerialNumberInfo

2

Tiny SCCM 2012 script to get Devices in a Collection and the last Logged on user

This script will get all devices and last logged on user in a specified Collection.
Just run the script in a PowerShell prompt as bellow:

GetCollectionDeviceAndUser.ps1 –CollectionName <Name of a Collection>

Download the script: GetCollectionDeviceAndUser

0

List SCSM 2012 Template Information

This script will list all SCSM Templates and show information about the following Templates:

  • Incident
  • Service Request
  • Problem
  • Change
  • Release

For Templates other than the one above the script will only show Title and Description information.

The script is dependent on the PowerShell module SMLets, so it needs to be installed before running the script.

To run the script just download it and run it in a PowerShell prompt. The output will look like something like this.

List SCSM 2012 Templates Information

PowerShell script: GetSCSMTemplateInformation

0