Create function new-sccmpackage sccm 2012

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #6570

    by medodk at 2012-12-14 00:28:41

    Hello
    I em new in powershell I try to make function to work new-sccmpackage in sccm 2012.

    I got Inspiration to from to places
    1.http://www.jbmurphy.com/2012/05/10/powe ... d-queries/
    This working with sccm 2007 but not in sccm 2012
    I em using XML files .All information is in xml files.

    Implement,PackageName,PackageManufacturer,PackageVersion,PackageLanguage,PackageComment,PackageSourcePath,PackageFolder
    Y,FireFox,Mozilla,17.0,Danish,New FireFox,\\sccm13\deploy\appl\Moxila\Firefox 17,

    Can anyone tell me how I wil do this

    [powershell

    Function New-SCCMPackage {
    [CmdletBinding()]
    PARAM (
    [Parameter(Mandatory=$true)][String] $PackageName,
    [Parameter(Mandatory=$true)][String] $PackageManufacturer,
    [Parameter(Mandatory=$true)][String] $PackageVersion,
    [Parameter(Mandatory=$true)][String] $PackageLanguage,
    [Parameter(Mandatory=$false)][String] $PackageComment = "",
    [Parameter(Mandatory=$false)][String] $PackageType = "0",
    [Parameter(Mandatory=$false)][String] $PkgSourceFlag = "2",
    [Parameter(Mandatory=$true)][String] $PackageSourcePath,
    [Parameter(Mandatory=$false)][String] $PackagePriority = "2"
    )
    $NewPackage = @{
    Name = $PackageName;
    Manufacturer = $PackageManufacturer;
    Version = $PackageVersion;
    Language = $PackageLanguage;
    Description = $PackageComment;
    PackageType = $PackageType;
    PkgSourceFlag = $PkgSourceFlag;
    PkgSourcePath = $PackageSourcePath;
    Priority = $PackagePriority
    }
    $newPkg = Set-WmiInstance -class SMS_Package -Arguments $newPackage -Namespace $Namespace
    $GetnewPkg = $newPkg.PSBase | Select * | out-null
    $packageID.PackageID
    $PackageID = $newPkg.PackageID}
    [/powershell]

    by Makovec at 2012-12-17 11:56:47

    Hi,
    can you please describe what exactly you want to do?

    There is a lot of unclear things to me:
    [list]
    [*]You use ps1 file and use it as module?[/*]
    [*]In Get-Package you use Set-WmiInstance. This is not correct IMHO.[/*][/list]
    Can you please specify what's your target and describe a bit your inputs?

    Thanks,
    David

    by medodk at 2012-12-19 13:31:35

    I run script
    Set-ExecutionPolicy RemoteSigned
    .\CreateFoldersAndCollections.ps1 .\Install.XML
    I found inspiration here but this work only with sccm 2007 but not in sccm 2012 +
    http://www.jbmurphy.com/2012/05/10/powe ... d-queries/
    I wont same results for Package(make package,make program,make qurey
    'I found som information on this page
    http://www.powershell.nu/2010/10/07/pow ... -packages/
    gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%office%"'
    gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%"'|gm
    $pkgoffice =gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%office%"'
    $pkgoffice | Select-Object -Property Name, Description, Version | Format-Table -AutoSize
    $pkgoffice.Description = "PowerShell Rocks"
    $pkgoffice.Put()
    I would like use powershell script to read information from xml files and create package,qurey,dp,programs.
    I hope someone will help me.

    by medodk at 2012-12-19 13:33:00

    I run script
    Set-ExecutionPolicy RemoteSigned
    .\CreateFoldersAndCollections.ps1 .\Install.XML
    I found inspiration here but this work only with sccm 2007 but not in sccm 2012 +
    http://www.jbmurphy.com/2012/05/10/powe ... d-queries/
    I wont same results for Package(make package,make program,make qurey
    'I found som information on this page
    http://www.powershell.nu/2010/10/07/pow ... -packages/
    gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%office%"'
    gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%"'|gm
    $pkgoffice =gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%office%"'
    $pkgoffice | Select-Object -Property Name, Description, Version | Format-Table -AutoSize
    $pkgoffice.Description = "PowerShell Rocks"
    $pkgoffice.Put()
    I would like use powershell script to read information from xml files and create package,qurey,dp,programs.
    I hope someone will help me.

    by medodk at 2012-12-19 13:35:13

    I run script
    Set-ExecutionPolicy RemoteSigned
    .\CreateFoldersAndCollections.ps1 .\Install.XML
    I found inspiration here but this work only with sccm 2007 but not in sccm 2012 +
    http://www.jbmurphy.com/2012/05/10/powe ... d-queries/
    I wont same results for Package(make package,make program,make qurey
    'I found som information on this page
    http://www.powershell.nu/2010/10/07/pow ... -packages/

    [/powershell]

    gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%office%"'
    gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%"'|gm
    $pkgoffice =gwmi -computer sccm13 -namespace root\sms\site_P01 -class sms_package -filter 'name like"%office%"'
    $pkgoffice | Select-Object -Property Name, Description, Version | Format-Table -AutoSize
    $pkgoffice.Description = "PowerShell Rocks"
    $pkgoffice.Put()

    would like use powershell script to read information from xml files and create package,qurey,dp,programs.
    I hope someone will help me.

You must be logged in to reply to this topic.