Showing posts with label SCCM. Show all posts
Showing posts with label SCCM. Show all posts

2016/08/29

PowerShell Tip - Generate a list of Mac Addresses

While playing in my lab I needed to create a bunch of fake Devices in System Center Configuration Manager (SCCM). When creation devices you need two pieces of information, the computer name and the Mac Address of the device.

I used the following method to generate my list of mac addresses.

# First, get a list of mac address.
1..150 | ForEach-Object { '{0:X12}' -f $_ }
# Second step: Before we import we need to add a colon ":" every two characters
1..150|%{((('{0:X12}' -f $_) -split '(..)')|?{$_}) -join ":"}


What is happening here

  1. We list from the number 1 to 150
    1. 1..150

2015/09/04

PowerShell/SCCM - Create a Dynamic Variable list during the task sequence

In my previous article I talked about SCCM Application and how to retrieve the applications targeted to a user.

Today I'll show how we can build a function to create a list of dynamic variables. This would be used in a Task Sequence during the Operating System Deployment in the task "Install Application".

First we will need to find the list of applications and then create a variable with a specific pattern for each of them.

What does it look like inside the task Sequence ?

Before we dig into the PowerShell, I think it is important to understand where everything will goes.

In the following task "Run PowerShell Shell Script", the script will retrieve in SCCM all the Applications advertised on the users (showed in previous article) and then create a bunch of variables that will be used in the task "Install Application".



2015/09/03

PowerShell/SCCM - Find Applications advertised to a user

The following function helps you retrieve all the deployment that a user is supposed to received.

We use this during the Operating System Deployment (OSD). Using the UDI we get the user account that will receive the workstation currently being deployed. This script allow us to retrieve in SCCM all the Application advertised on the user that needed to be deployed on the computer during the task sequence.

I know this could probably be done with the Configuration Manager module, but I'm pretty new with it and I was not sure it could be loaded in a task sequence, if you have the answer let me know in the comment section.

Here is the step by step how I found my solution. You can also go straight to the function at the end of this article.

Define Default Parameters

First I define a splatting to avoid repeating the same parameters in each command.
# Define default parameters (Splatting)
$Splatting = @{
    ComputerName = "Sccm01.lazywinadmin.com"
    NameSpace = "root\SMS\Site_FX1"
}

Retrieve a user in SCCM CMDB

Then I need to find a user in the SCCM Database to retrieve its ResourceID.
# Find the User in SCCM CMDB
$User = Get-WMIObject @Splatting -Query "Select * From SMS_R_User WHERE UserName='FxTest'"

Retrieve the collections the user is member of

# Find the collections where the user is member of
$Collections = Get-WmiObject -Class sms_fullcollectionmembership @splatting -Filter "ResourceID = '$($user.resourceid)'"

2015/08/15

Windows 10 ADK - Issues while uninstalling Windows 8.1 ADK and installing Windows 10 ADK

Installing Windows 10 Assessment and Deployment Kit (ADK) on SCCM 2012 R2 SP1 was a bit tricky. To "upgrade" the Windows ADK from 8.1 to 10, Microsoft recommend to remove Windows 8.1 ADK prior to the installation of Windows 10 ADK. We had some issue uninstalling Windows 8.1 ADK and installing the Windows 10 ADK


Uninstalling the Windows 8.1

Issue

Uninstall did not complete successfully.
An error occured while uninstalling "Deployment Tools."

Could not acquire privileges; GLE=0x514
Returning Status 0x514

You can also look at the ADK install/uninstall logs here: C:\Users\<Account>\AppData\Local\Temp\adk


We found different solutions online such as:

  • Unjoin, install ADK and Rejoin the computer to the domain
  • Run the installer as a Local Administrator or domain admin
Unjoining the machine was out of questions and the second solution did not work (Same error message).

I also tried to
  • Remove one component at the time but always got stuck on the "Deployment Tools" component.
  • Repair W8.1 ADK and try again
Same result...

2013/06/28

PowerShell SCCM 2007 Module - My contribution

I recently contributed to a PowerShell module called SCCM Automation created by Andre Bocchini. (SCCM stands for System Center Configuration Manager)

Take a look at it on GitHub here: https://github.com/andrebocchini/sccm-powershell-automation-module Andre really did an awesome job on this module!

This Module for SCCM 2007 (which does not come with a set of PowerShell Cmdlets) allows you to query Computers, Collections, Advertisements etc... (Check the Full list of Cmdlets)

However against big SCCM environment I notice some functions queries were very slow to report object.
After inspecting the code, I tweaked some parts of the code, especially on the Get-WmiObject queries.
Those modifications are now part of the module.

2011/04/26

What Anti-Virus scanning exclusions should be considered for system and servers ?

Source


Consider the following file scanning exceptions for your Anti-Virus software where applicable:

NOTE: The %systemroot% is normally the C:\WINDOWS or C:\WINNT directory depending on your OS.
NOTE: the %systemroot% variable will not work as an exclusion for some OSs.  So make sure to spell out full path in your exclusion files (GPO or via AntiVirus Server)

1.) %systemroot%\System32\Spool (and all the sub-folders and files)
2.) %systemroot%\SoftwareDistribution\Datastore
Refer to the following article for information:
KB822158 - Virus scanning recommendations for computers that are running Windows Server 2003, Windows 2000, or Windows XP http://support.microsoft.com/kb/822158
3.) Any Network Drives that are mapped.