Beantwortet Cannot GetSequence() on SMS_TaskSequencePackage

  • יום שישי 04 מאי 2012 23:06
     
      קוד כלול

    I'm running the following Powershell commands

    $TSPackageID = get-wmiobject -computername 'SCCMSERVER' -namespace 'root\sms\site_ABC' -query "SELECT * FROM SMS_TaskSequencePackage WHERE PackageID = 'XYZ00123'"
    
    $TSPackageID | gm -MemberType method
    
       TypeName: System.Management.ManagementObject#root\sms\site_ABC\SMS_TaskSequencePackage
    
    Name                  MemberType Definition                                                                                                     
    ----                  ---------- ----------                                                                                                     
    AddChangeNotification Method     System.Management.ManagementBaseObject AddChangeNotification()                                                 
    AddDistributionPoints Method     System.Management.ManagementBaseObject AddDistributionPoints(System.String[] SiteCode, System.String[] NALPath)
    RefreshPkgSource      Method     System.Management.ManagementBaseObject RefreshPkgSource()                                                      
    SetSourceSite         Method     System.Management.ManagementBaseObject SetSourceSite(System.String SourceSite)                                 
    Unlock 

    Shouldn't I be able to use method "$TSPackageID.GetSequence()" at this stage

    Using a "WMI Object Browser" I see that GetSequence is an available method, but  I get error:

    PS C:\WINDOWS\system32> $TSPackageID.GetSequence()
    Method invocation failed because [System.Management.ManagementObject#root\sms\site_ABC\SMS_TaskSequencePackage] doesn't contain a method named 'GetSequence
    '.
    At line:1 char:25
    + $TSPackageID.GetSequence <<<< ()
        + CategoryInfo          : InvalidOperation: (GetSequence:String) [], RuntimeException
        + FullyQualifiedErrorId : MethodNotFound

    I'm quite certain I'm doing this wrong. If anyone would be so kind as to give me a good example, I'd appreciate it.



    • נערך על-ידי BranM יום שישי 04 מאי 2012 23:13
    •  

כל התגובות

  • יום שישי 04 מאי 2012 23:22
    מנחה דיון
     
     
    Based on your first scriptblock, I do not see an available method named 'GetSequence'.  

    Rich Prescott | Infrastructure Architect, Windows Engineer and PowerShell blogger | MCITP, MCTS, MCP

    Engineering Efficiency
    @Rich_Prescott
    Windows System Administration tool
    AD User Creation tool

  • שבת 05 מאי 2012 06:14
     
     

    right, of course neither do I. But I keep seeing references to the "GetSequence()" method as an available Method. Such as these references

    SMS_TaskSequencePackage Server WMI Class: http://msdn.microsoft.com/en-us/library/cc144760.aspx

    and this one

    GetSequence Method in Class SMS_TaskSequencePackage: http://msdn.microsoft.com/en-us/library/cc146380.aspx

  • שבת 05 מאי 2012 08:05
     
     תשובה קוד כלול
    $TSPackage = get-wmiobject -computername 'SCCMSERVER' -namespace 'root\sms\site_ABC' -query "SELECT * FROM SMS_TaskSequencePackage WHERE PackageID = 'XYZ00123'"
    # get instance of class
    $SMSClass=[wmiclass]'root\sms\site_ABC:SMS_TaskSequencePackage'
    # use static method on class 
    $SMSClass.GetSequence($TSPackage)

    Here is one way to tell if  a method is static:

    $SMSClass=[wmiclass]'root\sms\site_ABC:SMS_TaskSequencePackage'
    $SMSClass.psbase.methods['GetSequence'].Qualifiers['Static'].Value



    ¯\_(ツ)_/¯





  • שבת 12 מאי 2012 00:23
    מנחה דיון
     
     

    As there has been no activity in this thread for a few days, we assume the issue is resolved. We will mark it as "answered" to assist others in similar situations. If you disagree, please reply with further information. You can unmark the answer if you wish. If a reply helped answer your question, please mark it as the answer.


    Richard Mueller - MVP Directory Services