How to install and configure SCCM Cmdlet Library

Benoit LecoursPowershell, SCCM2 Comments

Today, Microsoft has release the SCCM Cmdlet Library. The SCCM product group is taking a new update direction: from now on, the future Cumulative Updates (CU) releases won’t contain any PowerShell changes. The SCCM Cmdlet Library will be the vehicle for any future cmdlet updates. This separation means no more breaking cmdlets when updating to a new CU and more frequent cmdlets fixes/releases from Microsoft. Better of both world ! What’s even better is that it checks and notifies you automatically for library updates on a daily basis. Requirements SCCM 20012 R2 is supported (any CU) SCCM 2012 SP1 is not supported Read the release … Read More

New-CMDeviceCollectionVariable creating only 1 variable

Benoit LecoursPowershell, SCCM0 Comments

Update 2014-12-04 : Microsoft will have a fix in the next release of the PowerShell cmdlets. (Not released yet) I recently had a problem with the PowerShell command New-CMDeviceCollectionVariable creating only 1 variable. I had to create a set of collection with variables in an OSD project. The goal was to create 20 collections with 7 different variables. Nothing too complicated, Powershell to the rescue ! So I start creating my script, everything went smoothly, no errors were returned. After verification on the created collection I found out that only 1 variable per collection were created instead of the 7 intended. I decided to … Read More

Unable to install SCCM Client because of SmsSwDistCacheDirDelete in ccmsetup.log

Nicolas PilonClient, Powershell, SCCM0 Comments

During the SCCM client migration process from 2007 to 2012, I was unable to install client on a computer because of SmsSwDistCacheDirDelete in ccmsetup.log. It is checking for an existing old cache folder and trying to delete it. Symptom Your installation is stopped at SmsSwDistCacheDirDelete. Cause The process is unable to delete the cache folder. Solution Delete the client cache folder and the installation will resume automatically. There’s a lot of way to configure or detect the cache folder. If you are using the client push installation feature, you can configure the cache folder with the installation properties by clicking on Administration – … Read More

PowerShell Script to delete Collections older than X Days under Specific Folder

Nicolas PilonPowershell, SCCM0 Comments

Did you ever wanted to delete a bunch of collections older than x days under specific folder name? I recently needed to clean collections older than 7 days under specific folders. The reason was simple, I came across a situation where the company own a custom package deployment solution and it create a collection each time a deployment is made. Since they are all limited collections, you can imagine the load it can create for the collection evaluator. The best solution would be to delete the collection as soon the deployment is succeeded, some internal politics prevents us to do that. … Read More

PowerShell Script Create Operational SCCM Collections

Benoit LecoursPowershell, SCCM22 Comments

PowerShell Script Create Operational SCCM collections In each SCCM project that I get involved, I get the same question : “Can you create a collection for Servers, Laptops, Workstation, Windows 7, Windows 8, ect…” With time I built a set of “Default” query for device collections that I create right after the initial SCCM setup. This set of collection usually covers 95% of the initial client needs. I’ve built a PowerShell script so the effort to create 56 collections is near to none. By running the Powershell script, you’ll end up having 56 collections in a Operational folder. The collections are set to refresh on … Read More

Start-CMPackageDeployment – Impossible to create a Required Package Deployment using CMDLET

Benoit LecoursPowershell, SCCM12 Comments

**Edit 2014/10/31 : I’m still struggling to make this cmdlet work with a Required schedule even if Microsoft says it’s fixed. If you have been able to make it work, leave a comment in this post. ** **Edit 2014/06/27 : This issue is supposedly fix with R2 CU2 ** The Start-CMPackageDeployment cmdlet is failing with the following error when creating a “Required” deployment with a schedule. Example : Start-CMPackageDeployment -CollectionName “$Name” -PackageId $PkgId -StandardProgramName “Install”  -DeployPurpose Available -DeploymentAvailableDay “2014/06/13” -DeploymentAvailableTime “12:12” -DeploymentStartDay “2014/06/19” -DeploymentStartTime “2:45”-RerunBehavior RerunIfFailedPreviousAttempt -SoftwareInstallation $True -SystemRestart $False Error : Start-CMPackageDeployment : Parameter set cannot be resolved using the specified named parameters. The … Read More

Manage SCCM Maintenance Windows with Powershell

Benoit LecoursPowershell, SCCM0 Comments

If you’re not aware, you can manage your SCCM maintenance Windows using PowerShell. Here’s a simple example but you can get creative. #Import SCCM Module Import-Module $env:SMS_ADMIN_UI_PATH.Replace(“bini386″,”binconfigurationmanager.psd1”) #Get SiteCode $SiteCode = Get-PSDrive -PSProvider CMSITE # Set Location to SCCM Set-Location “$($SiteCode.Name):” #Occurs Fourth day of every 3 months effective the time you create it at 3:00 AM $Schedule = New-CMSchedule -DurationCount 1 -DurationInterval Hours -RecurCount 3 -DayOfMonth 4 -Start ([Datetime]”3:00″) $Collection = Get-CMDeviceCollection -Name “Your Collection Name” New-CMMaintenanceWindow -CollectionID $Collection.CollectionID -Schedule $Schedule -Name “Your Schedule Name” More information and example on technet @ http://technet.microsoft.com/library/dn472934(v=sc.20).aspx You can also verify if your … Read More

PowerShell to change Page File Location in your SCCM TS

Benoit LecoursPowershell, SCCM7 Comments

SmsSwDistCacheDirDelete in ccmsetup.log 03

You can script the placement of the Windows page file in your SCCM Task Sequence. Sure you could use the good old wmic pagefileset but we’re in 2014, Powershell is your new friend ! My clients needed a script that : Disable page file on OS drive Move it to D: Set the page file based on the allocated memory installed (x1.5) I used a Powershell module found here. My Script then uses a function of this modules to fits my needs. Save this script in a .ps1 file. #Reads the physical memory and multiplies it by 1.5 $PageFileSizeMB = [Math]::Truncate(((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory) … Read More

Change CDROM Drive Letter using Powershell during OSD

Benoit LecoursPowershell, SCCM3 Comments

SmsSwDistCacheDirDelete in ccmsetup.log 03

By default, Windows will assign the next available letter to your CD/DVD ROM drive. For servers and even workstation it could be useful to change it to a standard value. Add a Run command Line step in the end of your task sequence that run a powershell command. %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command “(gwmi Win32_cdromdrive).drive | %{$a = mountvol $_ /l;mountvol $_ /d;$a = $a.Trim();mountvol z: $a}” You change the last Z: to another letter to fit your environment. Benoit LecoursFounder of System Center Dudes. Based in Montreal, Canada, Senior Microsoft SCCM Consultant, 4 times Enterprise Mobility MVP. Working in the industry since … Read More

SCCM 2012 Management Point Error 1603

Benoit LecoursPowershell, SCCM1 Comment

We have recently experienced a SCCM 2012 management point error 1603. Scenario : Installing a new MP gives an error 1603 SCCM 2012 R2 Windows 2012 R2 The first thing to check is the MPSetup.log, you can see the error 1603 but you have not much information about what’s the problem really is. You have to dig deeper in the MPMsiLog.LastError to see the root cause.                     As you can see the error is cause by a previous version of the client being installed on the server. My environment had SCCM … Read More