Home » Scripting »

PowerShell: LEAP Motion PowerShell Lottery Script @ Danish PowerShell User Group

In our geek club aka The Danish PowerShell user group, we always do a lottery in the end, for books or similar. To draw the correct winner we have been using a script that I have developed. I have for a long time, promised to release the script so that other user groups or other […]

Category: Powershell, Scripting  |  Comment

Specify a Runas Account for a monitor

If you need to individualize a monitor to run with a specific Account in SCOM, you could do it like this Powershell sample. Before importing the Managementpack please download and install the SamplePowershellMonitorWizardMP.zip, this is a really good one which easily take care of implementing Powershell script directly in the console. https://gallery.technet.microsoft.com/Sample-Management-Pack-17b76379 After this import […]

Category: Management Packs, Operations Manager 2012 R2, Powershell, SCOM  |  1 Comment

Create Status Filter Rules with PowerShell

Here is a quick example of creating a Status Filter Rule in Configuration Manager with PowerShell #Example 1 New-CMStatusFilterRule -SiteCode PS1 -Name ‘Remove PC from OSD Collection’ -MessageId 11144 -MessageType Milestone ` -RunProgram $True -ProgramPath ‘C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file D:\Scripts\Remove-CMDeviceFromCollection.ps1 -CollectionName "OSD Windows 8 Standard" -ComputerName %msgsys’ #Example 2 $Parameters = @{ SiteCode = ‘PS1’ Name = […]

Category: Configuration Manager, Configuration Manager 2012 R2, Powershell, Scripting  |  Comment

Beyond unsupported – How to add PowerShell ISE to ConfigMgr Admin Console

As you already know, then currently we can only start PowerShell Console through Configuration Manager Admin Console but most likely  you may want to start PowerShell ISE through Admin Console Step-by-step guide First, this is not supported so don’t blame me if something is not working. Please also remember that there is no SAVE button […]

Category: Configuration Manager, Configuration Manager 2012 R2, Powershell, Scripting  |  1 Comment

Working with Queries in ConfigMgr with PowerShell

I accidentally blew up my dev lab and now I need to build a new one but luckily we have PowerShell :). In this picture we have 8 Queries and I would like to create Device Collections based on these Queries. These Queries are built with Servicing Extension.   Here are some of the commands […]

Category: Configuration Manager, Configuration Manager 2012 R2, Powershell, Scripting  |  2 Comments

Quick intro to Configuration Items in ConfigMgr with PowerShell

Configuration Items that I would like to export and import   Here are some command examples that we can use in Configuration Manager 2012 R2 CU4. #Import Module Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") $SiteCode = Get-PSDrive -PSProvider CMSITE Set-Location "$($SiteCode.Name):\" #Get all CIs $ConfigurationItems = Get-CMConfigurationItem #Total CIs $ConfigurationItems.Count #Get CIs only with specific keyword $ConfigurationItems = Get-CMConfigurationItem […]

Category: Configuration Manager, Configuration Manager 2012 R2, Powershell, Scripting  |  Comment

New ConfigMgr PowerShell cmdlets in CU4

Microsoft just released a new CU for Configuration Manager and with latest CU we got 35 PowerShell cmdlets. Now we have 597 PowerShell cmdlets. Here are the new ones: Add-CMDeploymentTypeDependency Add-CMDeploymentTypeSupersedence ConvertFrom-CMApplication ConvertFrom-CMConfigurationItem ConvertTo-CMApplication ConvertTo-CMConfigurationItem Get-CMCertificate Get-CMClientOperation Get-CMDeploymentTypeDependency Get-CMDeploymentTypeDependencyGroup Get-CMDeploymentTypeSupersedence Get-CMMigrationSource Get-CMObjectSecurityScope Get-CMQuery Get-CMSiteRole Invoke-CMGroupDiscovery Invoke-CMQuery Invoke-CMSystemDiscovery Invoke-CMUserDiscovery New-CMADGroupDiscoveryScope New-CMDeploymentTypeDependencyGroup New-CMEmbeddedObjectInstance New-CMEmbeddedProperty New-CMEmbeddedPropertyList New-CMQuery Remove-CMCollection […]

Category: Configuration Manager, Configuration Manager 2012 R2, Powershell, Scripting  |  2 Comments

Create ConfigMgr Collections and Admin Console Folders with PowerShell

Starting from ConfigMgr 2012 R2 we can use New-Item PowerShell cmdlet to create ConfigMgr Admin Console folders. Here is one simple and quick PowerShell script that allows you to create folders and Collections and finally it moves the Collection to correct folder. #Step 1 Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") $SiteCode = Get-PSDrive -PSProvider CMSITE Set-Location "$($SiteCode.Name):\" #Step 2 […]

Category: Configuration Manager, Configuration Manager 2012 R2, Powershell, Scripting  |  3 Comments

Create Shortcut With Elevated Rights

How do I create a shortcut that runs as Administrator?

Category: Powershell, Scripting, Software distribution, Tips and tricks  |  1 Comment

Service Manager powershell snippets

Merry x-mas! In today’s December calendar tips & trick I’m going to a post some useful powershell snippets for Service Manager. As we all know, the December 11th is the special day where the Bethlehem-powershell star outshined all the others.        The scripts here is mostly for administrative purposes. They are of course […]

Category: Administration, Management Packs, Powershell, Service Manager  |  Comment