Script powerShell to create user Category for catalogue SCCM 2012

Script powerShell to create user Category for catalogue SCCM 2012


You have a list of category to implemente on System configurqtion Manager 2012 r2.

Heres a script powershell that will do it for you :





Function Create-AdministrativeCategory
{
    [CmdLetBinding()]
     Param(
 
    [Parameter(Mandatory=$True,HelpMessage="Please Enter Category Name")]
              $CategoryInstanceName
         )

   
              $SiteCode = "Site code"
             $SiteServer = "SCCM Server"
 
         
 

    #New GUID for the Category
    $GUID = [GUID]::NewGuid().ToString()

    #Create the SMS_Category_LocalizedProperties property
    $NewCat = ([WMIClass]"$SiteServer ootSMSSite_$($SiteCode):SMS_Category_LocalizedProperties").CreateInstance()
    $NewCat.CategoryInstanceName = $CategoryInstanceName
    $NewCat.LocaleID = 0

    #Create the New Category Instance
    $Arguments = @{CategoryTypeName = "CatalogCategories"; LocalizedInformation = [ARRAY]$NewCat; SourceSite = $SiteCode;CategoryInstance_UniqueID = "CatalogCategories:$GUID"}
    Try{
        Set-WmiInstance -Namespace "RootSMSSite_$SiteCode" -Class "SMS_CategoryInstance" -ComputerName $SiteServer -Arguments $Arguments
    }
    Catch{
        $_.Exception.Message
    }  
}

#List of category to add for web catalog
$PrdAppList = @("Free application","Windows 10 Applications","Virtual applications","Windows 7 to windows 10","Licenced applications","Downloaded applications","Iphone applications","Adroid applications","Windows Phone applications","Microsoft Applications","Security Applications")

foreach ($PrdApp in $PrdAppList)
{
    Create-AdministrativeCategory -CategoryInstanceName $PrdApp
}


Available link for download

download
alternative link download
Script powerShell to create user Category for catalogue SCCM 2012 Script powerShell to create user Category for catalogue SCCM 2012 Reviewed by renata on 10:54 AM Rating: 5