Upgrade System Center Configuration Manager Console with PowerShell

Since Service Pack 1 was released to SCCM 2012 R2 I have been upgraded several environments. A couple of customers wanted me to create a PowerShell script to uninstall existing ConfigMgr Console and install the new updated version with the latest cumulative updates and hotfixes. If you create a package to distribute it with SCCM make sure you point the Data source to the location of the Client installations files, Script, KB3084586-msp and kb3074857-msp. Installation command for the program will then be: PowerShell.exe -file "script.ps1". Remember to set PowerShell execution policy to "Bypass" under Client Settings. This will not affect [...]

By |2015-09-17T18:14:33+01:00september 17th, 2015|Configuration Manager (SCCM), General info, Powershell, Scripting & Development|Kommentarer lukket til Upgrade System Center Configuration Manager Console with PowerShell

Azure Automation: New Features announced!

Today at the PowerShell summit in Stockholm,  Joe Levy and Anatoli Beliaev of Microsoft announced a bunch of new features that is publicly available in Azure Automation! Unfortunately I was not able to be there in person, but luckily multiple people tweeted about this stuff! (Thanks @vNiklas + @skillriver + more!! ) Some of the features is what I have demoed at multiple session within the last month. (SCU + User groups). Here is the list: Gallery Support Gallery has been expanded and has a nice button for it the gallery now also includes powershell scripts. PowerShell Script Runbooks Use [...]

By |2015-09-15T14:03:34+01:00september 15th, 2015|Azure, Scripting & Development|Kommentarer lukket til Azure Automation: New Features announced!

Automate Signature And Status Reports With PowerShell – Windows Defender (.txt file)

What you will be able to after reading this blog: Get the latest information about "your" Signature- & Anti Virus reports in Windows Defender and make it into a text file. How to automate it, so it will run every day and give you a status report with time and date. Being able to look at what time and date the latest updates have been completed. First of all, we have to create a folder/directory where the status reports can be stored in. Open up PowerShell in administrative mode and run this script only by copy-paste: $path="C:\" New-Item .\AVStatusReports -ItemType [...]

PowerShell Script That Creates A Folder And A Shortcut On Your Desktop

Basic example of a script that creates a folder in your Local Disk "C"  and then makes a shortcut on desktop so you have easy access to the folder. First of all, open your powershell as administrator and make sure you are at a place where you are able to create folders such as the C:\ drive. PS C:\WINDOWS\system32> cd .. PS C:\WINDOWS> cd .. PS C:\> And now you are able to run the script! - Copy and paste what is written below $path = "C:\" New-Item .\EpicFolder -ItemType Directory -Force $wshshell = New-Object -ComObject WScript.Shell $desktop = [System.Environment]::GetFolderPath('Desktop') [...]

By |2015-09-14T14:21:32+01:00september 14th, 2015|General info, Powershell, Scripting & Development|Kommentarer lukket til PowerShell Script That Creates A Folder And A Shortcut On Your Desktop

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 interested people can use it for fun! It has amazing ascii graphics and colors!!! It will take you straight back to your C64 loading screen! The script is a lottery script that takes a file from www.eventbrite.com containing all attendees. The script need a LEAP [...]

By |2015-06-22T14:59:47+01:00juni 22nd, 2015|Powershell, Scripting & Development|Kommentarer lukket til PowerShell: LEAP Motion PowerShell Lottery Script @ Danish PowerShell User Group

Azure Automation: New features including graphical designer and Hybrid Workers goes live!

Today at Ignite, Microsoft announced the next version of the portal for Azure Automation. This portal is part of the new Azure Portal, and you can try it out right away!! It has some great features in the interface and It enables proper Hybrid Cloud Automation! Execute Azure Automation runbook on-premise and trigger them from on-prem solutions!   Can I get a Woohoo!?   In this article, I will explain each feature in details New Graphical Runbook Designer interface (similar to the classic Orchestrator runbook designer) Hybrid Worker Role!! Web Hooks New portal design with better overview over runbooks, Assets etc. [...]

By |2015-05-04T17:30:01+01:00maj 4th, 2015|Automation, Azure|Kommentarer lukket til Azure Automation: New features including graphical designer and Hybrid Workers goes live!

Create Windows 10 Enterprise ISO from Professional media

Microsoft has released build 10041 of Windows 10 Technical preview, but again there is only an ISO for the Professional edition.The workaroundwell lucky for us, there is a way around this. It is possible to utilize DISM to change editions of Windows, so by running a few commands we can upgrade the install.wim from Pro to Enterprise.To do this you need a computer with Windows 10 installed, as we need the latest version of DISM. Simply install Windows 10 Pro using the latest release on a physical or virtual computer.Mount the Windows 10 Pro ISO, and copy the content to [...]

By |2015-04-21T10:14:14+01:00april 21st, 2015|General info, Windows Client|2 Comments

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 = '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' } New-CMStatusFilterRule @Parameters Execute the code     Happy Scripting

By |2015-03-23T13:16:47+01:00marts 23rd, 2015|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Create Status Filter Rules with PowerShell

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 in Admin Console Builder Tool! Close ConfigMgr Admin Console Start AdminUI.ConsoleBuilder.exe – You can find this tool under the Admin Console installation folder   Select File –> Open –> ConnectedConsole Select View->Application Menu Items Select Connect via Windows PowerShell and right-click select Clone Now [...]

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 -Name "*CT - *" -ForceWildcardHandling #CI rules with 'CT - ' keyword - 12 CIs in this example $ConfigurationItems.Count #Export out CIs with 'CT - ' keyword foreach($CI in $ConfigurationItems){ Write-Output -InputObject "Exporting out $($CI.LocalizedDisplayName) CI" Export-CMConfigurationItem -Path "$env:USERPROFILE\Desktop\CI_Rules\$($CI.LocalizedDisplayName).cab" -InputObject $CI } #New CI folder [...]

By |2015-03-16T09:50:54+01:00marts 16th, 2015|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Quick intro to Configuration Items in ConfigMgr with PowerShell

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 Remove-CMDeploymentTypeDependency Remove-CMDeploymentTypeDependencyGroup Remove-CMDeploymentTypeSupersedence Remove-CMQuery Set-CMDeploymentTypeDependency Set-CMDeploymentTypeDependencyGroup Set-CMDeploymentTypeSupersedence Set-CMQuery Sync-CMMigrationSource   Happy Scripting! :)

Service Management Automation: Runbook/Workflow for completing a SCSM SMA Runbook Activity

Almost christmas!   Today brings another example for handling Service Manager in in Service Management Automation (SMA), a part for Windows Azure Pack. More info: http://aka.ms/introToSMA SMA is based on PowerShell workflow, so this could be used in other scenarios than within SMA. This example is a runbook I use to complete an activity in service manager, in the end of most of my Service Manager runbooks. I do this cause I want to speed up the processing and not wait for the “Check SMA Runbook Activity Complete” workflow that runs every 5 minutes but completing the Runbook activity manually [...]

By |2017-08-22T09:25:51+01:00december 19th, 2014|Automation|Kommentarer lukket til Service Management Automation: Runbook/Workflow for completing a SCSM SMA Runbook Activity

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 New-Item -Name 'OSD' -Path 'PS1:\DeviceCollection' New-Item -Name 'Mobile Device Management' -Path 'PS1:\DeviceCollection' New-Item -Name 'Power Management' -Path 'PS1:\DeviceCollection' New-Item -Name 'ViaMonstra' -Path 'PS1:\DeviceCollection' New-Item -Name 'Software Updates' -Path 'PS1:\DeviceCollection' New-Item -Name 'Compliance' -Path 'PS1:\DeviceCollection' #Step 3 New-CMDeviceCollection -Name 'Test 1' -LimitingCollectionName 'All Systems' New-CMDeviceCollection -Name [...]

Service Management Automation: Runbook/Workflow for getting selected object(s) in an SCSM Request Offering Query Result Question

Hello Everyone! Today It is my turn to write in the Coretech christmas calendar! Currently I am working a lot in Service Management Automation (SMA), a part for Windows Azure Pack. More info: http://aka.ms/introToSMA SMA is based on PowerShell workflow, so this could be used in other scenarios than within SMA. The first example i want to show is an easy way to get the selected object(s) in a Service Manager Request Offering [download id="226"] Setup / Import Download or create Get-SCSMCIFromUserInput.ps1 Open WAP Admin Portal Go to Automation Import Runbook Creating Assets This runbook uses 2 assets. “SCSM Server” [...]

By |2017-08-22T09:25:51+01:00december 12th, 2014|Automation, Windows Azure Pack (WAP)|1 Kommentar

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 provided “as-is” so feel free to expand/optimize/ include more error handling etc. Create Management Pack UPDATE: Script now works with different windows localization. Default language will now be set according to the console language user preference and not the windows locale Unfortunately we are not [...]

By |2014-12-11T09:36:00+01:00december 11th, 2014|Powershell, Service Manager (SCSM)|Kommentarer lukket til Service Manager powershell snippets

Get Direct Collection Memberships And Machine Variables Information

On several occasions I have had the need to pull information on SCCM devices, and recently I was asked to do a backup of all client direct memberships and some specific machine variables. So I thought I would share my latest version of a script that does that. The script takes an argument that will allow you to limit the process to only a set of named clients or just one if you prefer. Param($clients) The script starts by create a class to contain the information pulled from SCCM, making it easier to work with afterwards. Add-Type -Language CSharpVersion3 @" [...]

By |2014-12-10T00:02:00+01:00december 10th, 2014|Configuration Manager (SCCM), General info, Powershell|Kommentarer lukket til Get Direct Collection Memberships And Machine Variables Information

How to populate object properties with data from a database using PowerShell

  You probably know how you can use a registry discovery to populate properties on windows computer instances, but what if you already have the data in SQL database/CMDB and want to avoid having to first write the data to the registry and then use a discovery to get the data into SCOM? Or what if the objects are not windows computers and hence the registry method is not an option? The solution is to use PowerShell to read  the data from the database and then update the objects in SCOM. This post will show you how to do this [...]

By |2014-12-09T04:09:00+01:00december 9th, 2014|Operations Manager (SCOM), Powershell|Kommentarer lukket til How to populate object properties with data from a database using PowerShell

Change device ownership in Configuration Manager with PowerShell

All newly enrolled devices are enrolled as Personal Devices by default in Configuration Manager and we cant change the default behavior. If the Device Ownership is Company, then we can inventory all the installed applications and we can also do mandatory installations. If the Device Ownership is Personal, then we can inventory only applications that are installed through Company Portal. If your company policy is that all the devices must be company-owned, then you can use this script to query a specific collection devices and it will set the Device Ownership to Company. Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") $SiteCode = Get-PSDrive -PSProvider CMSITE [...]

Configuration Manager 2012 SP1 and R2 PowerShell Provider

Updated 23.03.2015! As you might have already noticed that Configuration Manager PowerShell Provider is lot like Active Directory, Registry etc. provider. To run a cmdlet you need to be inside CMSITE. If you are still using SP1+, then: 1. you can´t use New-Item cmdlet to create folders 2. you can´t set the location to sub folders 3. Get-ChildItem does not work at all If you are using R2+, then 1. You can use New-Item to create folders 2. You can change the location i.e. sub folders etc. 3. Get-ChildItem only prints out folder objects but not collections, applications etc. inside [...]

By |2014-09-30T10:13:45+01:00september 30th, 2014|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Configuration Manager 2012 SP1 and R2 PowerShell Provider

PowerShell Deployment Toolkit: Windows Azure Pack install fails

I am a big fan of PDT but I have been trying to install Windows Azure Pack and the complete system center using PowerShell Deployment Toolkit Using the newest version (currently version 2.64.2611) it fails installing the Windows Azure Pack components! Luckily i found the error: Use a password for the installer user that follows the rules for Windows Azure Pack Minimum 8 chars Include at least one upper case letter and one lower case. include at least one number Include at least one non-alphanumeric. (In my case i was missing this! .. so added a ! to the password) [...]

By |2014-09-23T14:16:47+01:00september 23rd, 2014|Powershell, Windows Azure Pack (WAP)|2 Comments

New 3-day Workshop: Windows Azure Pack: Mastering Service Management Automation (SMA)

I am currently in development of my new mastering class in SMA. Here is the detailed info and upcoming dates Title Windows Azure Pack - Mastering Service Management Automation Days 3 Level 300 Trainer Jakob Gottlieb Svendsen, Cloud & Data Center MVP. Email: [email protected] MVP Profile: https://mvp.microsoft.com/en-us/mvp/Jakob%20Gottlieb%20Svendsen-5000333 Blog: https://blog.ctglobalservices.com/jgs Summary Go from A to Z in Service Management Automation. The new automation tool based on PowerShell Workflows. Beside the introduction, architecture and installation, this workshop focuses on designing Runbooks using PowerShell Workflows in SMA. Learn how to convert your knowledge of PowerShell scripts to PowerShell Workflows. We will start from [...]

By |2017-08-22T09:25:52+01:00september 23rd, 2014|Automation, Windows Azure Pack (WAP)|1 Kommentar

Scripts and links from my sessions @IT/Dev connections

A big thanks to all who attended at our sessions. Below are the links to the scripts and blog post we referenced during the session. Hope to see you all again next year! Managing Configuration Manager with PowerShell [download id="217"] Building Custom Tools Using PowerShell [download id="216"] Truly Better Together: Configuration Manager 2012 R2 and PowerShell [download id="215"] Quick and Dirty – Build Configuration Manager 2012 Admin Console Extensions automatically - http://cm12sdk.net/?p=2299 Configuration Manager 2012 R2 Developer Excel Sheet - http://cm12sdk.net/?p=2326 Does Your Hard Work Advance the Ecosystem? - http://blogs.msdn.com/b/powershell/archive/2011/02/07/does-your-hard-work-advance-the-ecosystem.aspx Coretech Collections Tool - https://blog.ctglobalservices.com/kaj/coretech-configuration-manager-2012-r2-powershell-automation-module-0-1/ Before you start using these script examples on your production environment, please make [...]

By |2014-09-21T20:10:39+01:00september 21st, 2014|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Scripts and links from my sessions @IT/Dev connections

Store encrypted password in a PowerShell script

I write a lot of PowerShell scripts where I need to access different kinds of services, servers and databases. Often these scripts needs to run on schedules in the background and so on. Instead of having cleartext passwords scattered throughout the scriptfile I like to store a securestring version of the password in the script. Normally you would build a credential object using something like this $username = "domain\admin" $password = "password" | ConvertTo-SecureString -AsPlainText -Force $cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password That means that anyone who can open and read the scriptfile, will know what the password [...]

By |2017-09-07T22:55:56+01:00september 10th, 2014|Powershell|17 Comments

Coretech Configuration Manager 2012 R2 PowerShell automation module 0.1

During the TechEd Kent showed one of our solution that allows you to save all the Collections to an Excel file or to create Collections based on Excel template. We have received a lot of emails and twitter tweets that when we are going to publish it and good news is that we will publish it now :) . If you haven't seen the Kent TechEd video, then I recommend to watch it before you use this module. This is not the latest version and it is work in progress release. We will continue to improve this PowerShell module. Here [...]