Om Kaido Järvemets

Configuration Manager MVP

How to change Configuration Manager Hardware Inventory Schedule Client Setting

Today I tried to modify Hardware Inventory Schedule client setting and it didn't work. First I thought that I did something wrong or the cmdlet is broken. Here is the cmdlet Verbose output Then I thought that, lets disable the HW client setting and then enable the HW client setting with correct schedule and Bingo it worked correctly. #Step 1 $ClientSettingsName = 'HW Settings' Set-CMClientSetting -Name $ClientSettingsName -EnableHardwareInventory $false -Verbose -Debug #Step 2 $CMWeeklySchedule = New-CMSchedule -RecurCount 1 -RecurInterval Hours Set-CMClientSetting -InventorySchedule $CMWeeklySchedule -Name $ClientSettingsName -EnableHardwareInventory $True -Verbose -Debug If you compare the verbose outputs, then you will see the [...]

Export out User Device Affinity Relationship with PowerShell

This script allows to export out specific collection UDA Relationships to a CSV file. Here is the script it self. Run it on your Primary Site Server and then open the CSV file with Excel. <# .Synopsis This script exports out specific collection UDA Relationships .DESCRIPTION .EXAMPLE Export-CMUDARelationships.ps1 -DeviceCollectionName "All Systems" -OutPut C:\Scripts\Reports\UDA.csv -SiteCode PS1 .NOTES Developed by Kaido Järvemets, Coretech A/S Version 1.0 #> Param( [Parameter(Mandatory=$True,HelpMessage="Please Enter ConfigMgr Collection Name",ParameterSetName='CSV')] $DeviceCollectionName, [Parameter(Mandatory=$True,HelpMessage="Please Enter CSV file location",ParameterSetName='CSV')] $OutPut, [Parameter(Mandatory=$True,HelpMessage="Please Enter ConfigMgr site code",ParameterSetName='CSV')] $SiteCode ) $CollectionQuery = Get-CimInstance -Namespace "Root\SMS\Site_$SiteCode" -ClassName "SMS_Collection" -Filter "Name='$DeviceCollectionName' and CollectionType='2'" $ResourcesInCollection = Get-CimInstance -Namespace [...]

The EASY WAY – List objects in specific folder in Configuration Manager 2012 with PowerShell

Last week I saw one blog post how to list specific folder objects and I believe that actually there is much easier way to list the objects in specific folder. First we need to figure out the ContainerNodeID which is the folder unique ID. We have several ways to find out the folder unique ID, for example we can run the ConfigMgr Admin console in developer mode or we can use a WMI tool. There are different WMI tools that you can find from the internet or you can simple use the WBEMTEST tool also which is already built-in in [...]

How to move objects in Configuration Manager Admin Console with PowerShell

Starting with Configuration Manager 2012 R2 we have a cmdlet called Move-CMObject. This cmdlet allows to move different objects in Admin Console. We still don't have a cmdlet that allows to create ConfigMgr Admin Console folders but if necessary you can use this code to create folders. Here are 6 different examples How to move objects in ConfigMgr Admin Console # Example 1 $CMCollection = Get-CMDeviceCollection -Name "OSD - Windows 8.1" Move-CMObject -FolderPath "PS1:\DeviceCollection\OSD" -InputObject $CMCollection # Example 2 $CollectionID = "PS10036C" Move-CMObject -FolderPath "PS1:\DeviceCollection\OSD" -ObjectId $CollectionID # Example 3 $ConfigurationItem = Get-CMConfigurationItem -Name "Business Hours" Move-CMObject -FolderPath "PS1:\ConfigurationItem\LOB" -InputObject [...]

Simple workflow for Configuration Manager Client installation

Here is a really simple Configuration Manager Client installation PowerShell workflow. This workflow queries all the clients where ClientType property is NULL. You can easily add logging, scheduling etc. workflow Install-CMClient { Param( $SiteCode, $SiteServer ) $Computers = Get-WmiObject -Namespace "Root\SMS\Site_$($SiteCode)" ` -Query "Select Name from SMS_R_System where ClientType is NULL" -PSComputerName $SiteServer Write-Output -Input "Total computers without Configuration Manager Client:$($Computers.Count)" ForEach -parallel ($item in $Computers){ $Path = "\\$($item.Name)\c$" if(Test-Path -Path $Path) { Write-Output -Input "Copying installation files to $($item.Name) TEMP folder" Copy-Item -Path "\\Terminaator\CMClient" -Destination "\\$($item.Name)\c$\TEMP" -Recurse -Force Inlinescript{ Write-Output -Input "Starting CCMSETUP.EXE on $($Using:Item.Name)" Start-Process -FilePath "C:\TEMP\CCMSETUP.EXE" } [...]

Dealing with Network Printers in Configuration Manager 2012

There are multiple ways how you can add a network printer to a PC and of course you can do that also with Compliance Settings in Configuration Manager. In PowerShell we can use Add-Printer cmdlet and if you don’t have the latest PowerShell version, then you can use Win32_Printer WMI class to add the Printer. If you don’t want to depend on a specific PowerShell version, then maybe the easiest way is to use Win32_Printer WMI Class. Here are the scripts/cmdlets that you can use Discovery Scripts Option 1 Win32_Printer WMI Class query Get-WmiObject -Class Win32_Printer -Filter "Name='\\\\CTTERM\\CTColorPrint01'" | Measure-Object [...]

Why I can’t convert my Windows Server 2012 R2 Core to GUI

Let’s assume that you installed some time ago one Windows Server 2012 R2 Server Core and you have installed also latest Windows Updates to that server and this server does not have an internet connection. Here are the updates that are installed In one day you discover that you need to add graphical user interface and you execute the following command Install-WindowsFeature Server-Gui-Shell -Source:wim:D:\Sources\install.wim:2 You will see that it reaches to 68% and fails with following error Install-WindowsFeature : The request to add or remove features on the specified server failed. Installation of one or more roles, role services, or [...]

By |2014-01-23T11:53:34+01:00januar 23rd, 2014|Operating Systems, Powershell, Windows Server|18 Comments

Installing a Domain Controller on Windows Server 2012 R2 Core

In my previous post I showed how you can install Active Directory Domain Services on Windows Server Core and in this post I´m going to show how you can add an additional Domain Controller to your environment because best practice recommends that you have at least two of them. To add an additional Domain Controller we need to do following: 1. Rename the server 2. Set the IP and DNS address 3. Join the server to domain 4. Install Active Directory Domain Services Server Role 5. Deploy the Domain Controller   Before you continue I recommend to read my first [...]

By |2014-01-21T14:18:27+01:00januar 21st, 2014|Powershell, Windows Server|2 Comments

Installing Active Directory Domain Services on Windows Server 2012 R2 Core

Installing Active Directory Domain Services on Windows Server Core is really easy. You only need to run 8 commands and your Domain Controller is ready. These steps are: 1. Rename the server 2. Set the IP and DNS address 3. Install Active Directory Domain Services Server Role 4. Promote the server to a Domain Controller Let’s Get Started :) I assume that you already have one Windows Server Core installed. If you log in, then it automatically runs command prompt. To get to PowerShell, then just type PowerShell.exe and you are ready to configure your Domain Controller. I don’t like [...]

By |2014-01-21T11:56:47+01:00januar 21st, 2014|Windows Server|12 Comments

How to add Configuration Manager Distribution Point Remotely with PowerShell

If you are trying to add a Configuration Manager Distribution Point remotely you may end up with issue: WARNING: The self-signed certificate could not be created successfully Validation of input parameters failed. Cannot Continue Code example Invoke-Command -ScriptBlock { #Step 1 Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") #Step 2 $SiteCode = Get-PSDrive -PSProvider CMSITE #Step 3 Set-Location "$($SiteCode.Name):\" #Step 4 Add-CMDistributionPoint -SiteSystemServerName TestServer.corp.viamonstra.com -SiteCode $SiteCode.Name ` -ClientConnectionType Intranet -MinimumFreeSpaceMB 50 -PrimaryContentLibraryLocation Automatic ` -SecondaryContentLibraryLocation Automatic -PrimaryPackageShareLocation Automatic -EnablePxeSupport ` -SecondaryPackageShareLocation Automatic -CertificateExpirationTimeUtc ((Get-Date).AddYears(100)) -ErrorAction STOP } -ComputerName CM01.corp.viamonstra.com If you take same code and run it locally on your Primary Site Server, then it [...]

Modify Maintenance Windows with Configuration Manager cmdlets

One of the new features in Configuration Manager 2012 R2 is that you can configure Maintenance Windows only for Software Updates We can configure all these new stuff with ConfigMgr cmdlets also :) #Import ConfigMgr PSH Module Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") #Get the CMSITE SiteCode $SiteCode = Get-PSDrive -PSProvider CMSITE # Change the connection context Set-Location "$($SiteCode.Name):\" #Apply MW only to Task Sequence $Collection = Get-CMDeviceCollection -Name "MW 2 - LOB Servers" Set-CMMaintenanceWindow -CollectionID $Collection.CollectionID -ApplyToTaskSequenceOnly -Name "TEST 2" #Apply MW only to Software Updates $Collection = Get-CMDeviceCollection -Name "MW 2 - LOB Servers" Set-CMMaintenanceWindow -CollectionID $Collection.CollectionID -ApplyToSoftwareUpdateOnly -Name "TEST 2" #Modify [...]

By |2013-10-18T09:28:43+01:00oktober 18th, 2013|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Modify Maintenance Windows with Configuration Manager cmdlets

Create Maintenance Windows with Configuration Manager cmdlets

Configuration Manager 2012 R2 PowerShell module contains now New-CMMaintenanceWindow cmdlet :) #Import ConfigMgr PSH Module Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") #Get the CMSITE SiteCode $SiteCode = Get-PSDrive -PSProvider CMSITE # Change the connection context Set-Location "$($SiteCode.Name):\" #Occurs day 3 of every 2 months effective 10/17/2013 1:00 PM $Schedule = New-CMSchedule -DurationCount 1 -DurationInterval Hours -RecurCount 2 -DayOfMonth 3 -Start ([Datetime]"13:00") $Collection = Get-CMDeviceCollection -Name "MW 1 - Windows Servers" New-CMMaintenanceWindow -CollectionID $Collection.CollectionID -Schedule $Schedule -Name "TEST 1" #Occurs the First Thursday of every 2 months effective 10/17/2013 1:00 PM $Schedule = New-CMSchedule -DurationCount 1 -DurationInterval Hours -RecurCount 2 -DayOfWeek 4 -WeekOrder First -Start [...]

New cmdlets in Configuration Manager 2012 R2

Here are the new cmdlets in Configuration Manager 2012 R2. Now we have totally 560 cmdlets Copy-CMClientAuthCertificateProfileConfigurationItem Copy-CMRemoteConnectionProfileConfigurationItem Copy-CMTrustedRootCertificateProfileConfigurationItem Copy-CMVpnProfileConfigurationItem Copy-CMWirelessProfileConfigurationItem Get-CMAccessLicense Get-CMClientAuthCertificateProfileConfigurationItem Get-CMClientOperations Get-CMDeviceVariable Get-CMInitialModifiableSecuredCategory Get-CMMaintenanceWindow Get-CMRemoteConnectionProfileConfigurationItem Get-CMRemoteConnectionProfileConfigurationItemXmlDefinition Get-CMTrustedRootCertificateProfileConfigurationItem Get-CMVhd Get-CMVpnProfileConfigurationItem Get-CMWirelessProfileConfigurationItem Invoke-CMClientNotification Invoke-CMContentValidation Invoke-CMDeviceRetire Invoke-CMDeviceWipe Move-CMObject New-CMClientAuthCertificateProfileConfigurationItem New-CMDeviceVariable New-CMMaintenanceWindow New-CMRemoteConnectionProfileConfigurationItem New-CMTrustedRootCertificateProfileConfigurationItem New-CMVhd New-CMVpnProfileConfigurationItem New-CMWirelessProfileConfigurationItem Publish-CMPrestageContentTaskSequence Remove-CMClientAuthCertificateProfileConfigurationItem Remove-CMContentDistribution Remove-CMDeviceVariable Remove-CMMaintenanceWindow Remove-CMRemoteConnectionProfileConfigurationItem Remove-CMTrustedRootCertificateProfileConfigurationItem Remove-CMVhd Remove-CMVpnProfileConfigurationItem Remove-CMWirelessProfileConfigurationItem Set-CMAssignedSite Set-CMClientAuthCertificateProfileConfigurationItem Set-CMDeviceOwnership Set-CMDeviceVariable Set-CMMaintenanceWindow Set-CMRemoteConnectionProfileConfigurationItem Set-CMTrustedRootCertificateProfileConfigurationItem Set-CMVhd Set-CMVpnProfileConfigurationItem Set-CMWirelessProfileConfigurationItem Get-CMInitModifiableSecuredCategory

Quick and Dirty – Build Configuration Manager 2012 Admin Console Extensions automatically

I just finished one PowerShell script that queries all the Admin Console XML files and it creates automatically Admin Console Extension. You can use this script to locate correct place for you right-click tool. There are totally 655 Console GUIDs. You can download the script from here  

By |2013-10-15T13:27:20+01:00oktober 15th, 2013|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Quick and Dirty – Build Configuration Manager 2012 Admin Console Extensions automatically

Can you combine Get-WmiObject with ConfigMgr cmdlets? Yes, you can

Last week I discovered that you can create a Refresh Schedule with New-CMSchedule cmdlet and then you can easily use that object with Get-WmiObject cmdlet to query and modify for example Device Collection Refresh Schedule. Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") $SiteCode = Get-PSDrive -PSProvider CMSITE Set-Location "$($SiteCode.Name):\" $Schedule = New-CMSchedule -RecurCount 2 -RecurInterval Days $Collection = Get-WmiObject -Namespace "Root\SMS\Site_PS1" -Class SMS_Collection -Filter "Name='Windows 8.1 OSD'" $Collection.RefreshType = 2 $Collection.RefreshSchedule = $Schedule.psbase.ManagedObject $Collection.Put() You can create the Device Collection with correct Refresh Schedule but Set-CMDeviceCollection cmdlet does not allow to change the Refresh Schedule. $Schedule = New-CMSchedule -RecurCount 2 -RecurInterval Days New-CMDeviceCollection -Name "Windows [...]

By |2013-10-14T10:28:47+01:00oktober 14th, 2013|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Can you combine Get-WmiObject with ConfigMgr cmdlets? Yes, you can

PoshCAT 0.2 version released

I just published PoshCAT 0.2 version and the changes are as follows: · New Client Actions o Desired Configuration Manager Cycle o Application Machine Policy Cycle o Application Global Evaluation Cycle o Install ConfigMgr Client o Get App-V Client Packages o Get App-V Client Configuration o Get App-V Client Version o Enable App-V Client Package Scripts o Get ConfigMgr Client Available Applications o Get Applied Group Policies o Refresh Group Policies o Get Free Disk Space · Alternate Credentials Support – you can specify only one account · Active Directory Connector · Better error handling · Separate folder for reports [...]

Building PoshCAT Part 3 – Enabling PowerShell Remoting through Group Policy for PoshCAT

You may want to read these posts before: · How to install PoshCAT · Building PoshCAT Part 1 – Create different Client Actions lists · Building PoshCAT Part 2 – Adding your own custom functions One of the most important thing you need to know before you start using PoshCAT is that it relies on PowerShell remoting. If you don’t configure PowerShell remoting on your computers, then the Client Actions will fail. In this post I will show how you can enable PowerShell remoting through Group Policy but you can also configure it manually. To enable PowerShell remoting manually you [...]

Building PoshCAT Part 2 – Adding your own custom functions

Last week I showed how you can create different Client Actions lists for different support groups in your organization and in this post I will show how you can add/create your own custom functions for PoshCAT So let’s assume that you would like to query applied Computer Group Policy objects. If you want that your custom function returns some kind of information, then it must return PSObject. Here is the function that I use in this example. This function queries only applied/enabled policies 1 Function Get-ComputerAppliedPolicies 2 { 3 $GPOPolicies = @() 4 $GPOQuery = Get-WmiObject -Namespace "ROOT\RSOP\Computer" -Class RSOP_GPLink [...]

Building PoshCAT Part 1 – Create different Client Actions lists

Last week I published our new tool PoshCAT and in the upcoming weeks I will cover different things. In this blog post I will show how to create different Client Action lists for different support groups. PoshCAT uses XML based configuration file for different Client Actions that you can execute through UI. One of the main ideas was that the tool should be customizable: · Ability to add and remove commands from UI · Ability to add your own custom actions/functions By default there are over 30 commands that are ready for use. Commands.xml configuration · TASK – Client Action [...]

By |2013-08-13T09:34:57+01:00august 13th, 2013|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til Building PoshCAT Part 1 – Create different Client Actions lists

How to install PoshCAT

1. Download and Unzip PoshCAT_v0.2.zip 2. Right-Click Start-PoshCAT.ps1, WorkerFunctions.ps1, SharedFunctions.ps1 and Commands.xml and select properties. 3. Unblock the files if needed and click OK. 4. Right-click Start-PoshCAT.ps1 and choose Run with PowerShell 5. If you don’t have administrative permissions, this message will be shown.   Enjoy!

SCCM Client Actions Tool PowerShell Edition aka PoshCAT

Updated 28.08.2013 Description SCCM Client Actions Tool PowerShell Edition aka PoshCAT is a practical and simple PowerShell application for performing most common day-to-day administrative tasks on System Center 2012 Configuration Manager Clients. The tool allows running actions remotely on one or more computers simultaneously. A list of computers can be provided either from a file (CSV, TXT) or loaded from Configuration Manager Collection importer or through Add Computer prompt. You can find the old version from here SCCMCAT - https://sccmcat.codeplex.com/ by Christjan Schumann. Please read the documentation first and blog posts! Please read this post how to install PoshCAT - [...]

New Content on CM12SDK.Net

I just posted new content on CM12SDK.net How to modify Configuration Manager Client Cache Size How to Create a Software Update Deployment Template How to Create/Add Alerts for Software Update Deployments How to invoke Client Notification actions Configuration Manager 2012 Developer Excel Sheet – I removed all the old Excel sheets and now I have only one Excel sheet which contains all the necessary things. If you are working with Configuration Manager, then a few weeks ago we released our first version of WMI and PowerShell Explorer and there is one special feature for Configuration Manager administrators which allows you [...]

By |2013-07-12T14:07:30+01:00juli 12th, 2013|Configuration Manager (SCCM)|2 Comments