Author Archive | Jonathan

Run 80 Runbook jobs to test your Orchestrator installation

If you want to see how an Orchestrator Runbook server behaves when running many Runbook jobs you can try this two Runbooks. This two Runbooks will generate 80 jobs. If you have not made any configuration changes on how many jobs a Runbook server can handle, it will start the first 50 jobs and then continue the execute the rest of them as soon one finish.

If you have two Runbook servers the first 50 jobs will start on the primary Runbook server and then the rest (30) will execute on the second Runbook server.

To try this, import the Runbooks and create a “C:\TestRunbook” folder on each of the Runbook server/servers. In the TestRunbook folder you will get logs on which Runbook server the job was executed.

Screenshots of the Runbooks

Runbook: 1.1 Initialize Test

Test your Orchestrator installation to run 80 Runbook jobs1

Test your Orchestrator installation to run 80 Runbook jobs.png2

Test your Orchestrator installation to run 80 Runbook jobs.png3

Test your Orchestrator installation to run 80 Runbook jobs.png4

Runbook: 1.2 Test Runbook Servers

Test your Orchestrator installation to run 80 Runbook jobs.png5

Test your Orchestrator installation to run 80 Runbook jobs.png6

Screenshot of Job Concurrency Configuration for Runbook: 1.2 Test Runbook Servers

Test your Orchestrator installation to run 80 Runbook jobs.png7

 

Download Runbook: Will soon be uploaded!

0

Configuration Manager 2012 Add MSI Application with Powershell

I had the need to add a few MSI applications to my Configuration Manager environment and created a script to simplify this. The script will extract information from the MSI file and use the application name, application version and application manufacturer when adding the application to the SCCM. The script will also create a deployment type to the SCCM application.

To run the script just execute the following command in a PowerShell shell:
AddCMApp.ps1 –MSIFilePath ‘\\SCCM\PKG\App1\app1.msi’

PowerShell script

Param(
    [Parameter(Mandatory=$True)]
    [String]$MSIFilePath
)
Process
{
    # Variables
    $Manufacturer = “”
    $ProductVersion = “”
    $ProductName = “”
    $PWDBegin = $PWD
    $CMSiteCode = “P01” # Change this – This should be your site code
    $CMModule = ‘C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1’
 
    $MSIFileName = $MSIFilePath.split(“\”)[-1]
    Write-Host “FileName: ” $MSIFileName
 
    If ($MSIFileName.split(“.”)[-1].ToLower() -ne “msi”)
    {
        Write-Host “ERROR – The file “”$MSIFileName”” is not a MSI file”
        Break
    }
    If ((Test-Path $MSIFilePath) -eq $False)
    {
        Write-Host “ERROR – The path “”$MSIFilePath”” is not correct”
        Break
    }
   
    # Code inspired by http://winadminnotes.wordpress.com/2010/04/05/accessing-msi-file-as-a-database
    # Get MSI file information
    $WindowsInstaller = New-Object -com WindowsInstaller.Installer
    $Database = $WindowsInstaller.GetType().InvokeMember(“OpenDatabase”, “InvokeMethod”, $Null, $WindowsInstaller, @($MSIFilePath,0))
    $View = $Database.GetType().InvokeMember(“OpenView”, “InvokeMethod”, $Null, $Database, (“SELECT * FROM Property”))
    $View.GetType().InvokeMember(“Execute”, “InvokeMethod”, $Null, $View, $Null)
    $Record = $View.GetType().InvokeMember(“Fetch”, “InvokeMethod”, $Null, $View, $Null)
 
    While($Record -ne $Null)
    {
        $PropertyName = $Record.GetType().InvokeMember(“StringData”, “GetProperty”, $Null, $Record, 1)
        $PropertyValue = $Record.GetType().InvokeMember(“StringData”,”GetProperty”, $Null, $Record, 2)
 
        If ($PropertyName -eq “Manufacturer”)
        {
            Write-Host($PropertyName + ” = ” + $PropertyValue)
            $Manufacturer = $PropertyValue
        }
        If ($PropertyName -eq “ProductName”)
        {
            Write-Host($PropertyName + ” = ” + $PropertyValue)
            $ProductName = $PropertyValue
        }
        If ($PropertyName -eq “ProductVersion”)
        {
            Write-Host($PropertyName + ” = ” + $PropertyValue)
            $ProductVersion = $PropertyValue
        }
        If ($PropertyName -eq “ARPHELPLINK”)
        {
            Write-Host($PropertyName + ” = ” + $PropertyValue)
            $ARPHELPLINK = $PropertyValue
        }
        $Record = $View.GetType().InvokeMember(“Fetch”, “InvokeMethod”, $Null, $View, $Null)
    }
     
    Import-Module $CMModule
     $CMSiteCode = $CMSiteCode + “:”
     Set-Location $CMSiteCode
     
    If ((Get-CMApplication -Name “$ProductName $ProductVersion”) -ne $NULL)
    {
        Write-Host “ERROR – CM Application with name “”$ProductName $ProductVersion”” already exist”
    }
    Else
    {
        Write-Host “Adding CM Application: “”$ProductName $ProductVersion”””
        New-CMApplication -Name “$ProductName $ProductVersion” -Publisher $Manufacturer -SoftwareVersion $ProductVersion
    }   
   
    If ((Get-CMDeploymentType -ApplicationName “$ProductName $ProductVersion” -DeploymentTypeName $ProductName) -ne $NULL)
    {
        Write-Host “ERROR – CM Deployment Type with name “”$ProductName”” already exist”
        Set-Location $PWDBegin
        Break
    }
    Else
    {
        Write-Host “Adding CM Deployment Type: “”$ProductName”””
        Add-CMDeploymentType -ApplicationName “$ProductName $ProductVersion” -DeploymentTypeName “$ProductName” -AdministratorComment “Created by PowerShell” -InstallationProgram “msiexec /i $MSIFileName” -InstallationFileLocation $MSIFilePath -AutoIdentifyFromInstallationFile -ForceForUnknownPublisher $True -MsiInstaller
    }
 
    Set-Location $PWDBegin
}

Add many applications to SCCM 2012

To add more than one application just create a CMD file with the following information and put in the same directory as the PowerShell script file.

powershell.exe .\AddCMApp.ps1 -MSIFilePath ‘\\sccm2012\pkg\7z920-x64\7z920-x64.msi’
powershell.exe .\AddCMApp.ps1 -MSIFilePath ‘\\sccm2012\pkg\XML Notepad 2007\XmlNotepad.msi’
powershell.exe .\AddCMApp.ps1 -MSIFilePath ‘\\sccm2012\pkg\RDCMan\RDCMan.msi’
powershell.exe .\AddCMApp.ps1 -MSIFilePath ‘\\sccm2012\pkg\Java(TM) 6 Update 33\Java_6_Update_33.msi’

Downloads

AddCMApp Apps

2