locked
Strange behavior of System.Center.Service.Manager module - Cmdlet shows, but unable to run RRS feed

  • Question

  • I am trying to re-write some Powershell scripts using the OTB SM 2012 Cmdlets.

    The module is loaded, but the shell is acting as though it can not find the command????

    I closed out everything and started fresh and captured the errors below.

    PS C:\> Get-Module | fl
    
    
    Name              : System.Center.Service.Manager
    Path              : C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\System.Center.Service.Manager.psm1
    Description       :
    ModuleType        : Script
    Version           : 0.0
    NestedModules     : {}
    ExportedFunctions : Get-SCSMCommand
    ExportedCmdlets   : {}
    ExportedVariables : {}
    ExportedAliases   : {}
    
    
    
    PS C:\> Get-Command -Module System.Center.Service.Manager
    
    CommandType     Name                                                    Definition
    -----------     ----                                                    ----------
    Alias           Export-SCSMManagementPack                               Export-SCManagementPack
    Alias           Get-SCSMClass                                           Get-SCClass
    Alias           Get-SCSMClassInstance                                   Get-SCClassInstance
    Function        Get-SCSMCommand                                         ...
    Alias           Get-SCSMDiscovery                                       Get-SCDiscovery
    Alias           Get-SCSMGroup                                           Get-SCGroup
    Alias           Get-SCSMManagementGroupConnection                       Get-SCManagementGroupConnection
    Alias           Get-SCSMManagementPack                                  Get-SCManagementPack
    Alias           Get-SCSMObjectTemplate                                  Get-SCObjectTemplate
    Alias           Get-SCSMRelationship                                    Get-SCRelationship
    Alias           Get-SCSMRelationshipInstance                            Get-SCRelationshipInstance
    Alias           Get-SCSMRunAsAccount                                    Get-SCRunAsAccount
    Alias           Import-SCSMManagementPack                               Import-SCManagementPack
    Alias           New-SCSMADConnector                                     New-SCADConnector
    Alias           New-SCSMClassInstance                                   New-SCClassInstance
    Alias           New-SCSMCMConnector                                     New-SCCMConnector
    Alias           New-SCSMManagementGroupConnection                       New-SCManagementGroupConnection
    Alias           New-SCSMManagementPack                                  New-SCManagementPack
    Alias           New-SCSMManagementPackBundle                            New-SCManagementPackBundle
    Alias           New-SCSMOMAlertConnector                                New-SCOMAlertConnector
    Alias           New-SCSMOMConfigurationItemConnector                    New-SCOMConfigurationItemConnector
    Alias           New-SCSMRunAsAccount                                    New-SCRunAsAccount
    Alias           Protect-SCSMManagementPack                              Protect-SCManagementPack
    Alias           Remove-SCSMClassInstance                                Remove-SCClassInstance
    Alias           Remove-SCSMManagementGroupConnection                    Remove-SCManagementGroupConnection
    Alias           Remove-SCSMManagementPack                               Remove-SCManagementPack
    Alias           Remove-SCSMRelationshipInstance                         Remove-SCRelationshipInstance
    Alias           Remove-SCSMRunAsAccount                                 Remove-SCRunAsAccount
    Alias           Set-SCSMManagementGroupConnection                       Set-SCManagementGroupConnection
    Alias           Test-SCSMManagementPack                                 Test-SCManagementPack
    Alias           Update-SCSMClassInstance                                Update-SCClassInstance
    
    PS C:\> Get-SCSMClass
    Cannot resolve alias 'Get-SCSMClass' because it refers to term 'Get-SCClass', which is not recognized as a cmdlet, function, op
    erable program, or script file. Verify the term and try again.
    At line:1 char:14
    + Get-SCSMClass <<<<
        + CategoryInfo          : ObjectNotFound: (Get-SCSMClass:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : AliasNotResolvedException
    
    PS C:\> get-scclass
    The term 'get-scclass' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spellin
    g of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:12
    + get-scclass <<<<
        + CategoryInfo          : ObjectNotFound: (get-scclass:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    


    Joshua Fuente

    Thursday, December 27, 2012 9:00 PM

Answers

  • restarting the session fixed it... 

    Joshua Fuente

    • Marked as answer by Marcel Zehner Thursday, January 3, 2013 4:44 PM
    Thursday, December 27, 2012 10:30 PM

All replies

  • OK, DUH, I figured this one out, using the wrong file to load the module, correct line is below for anyone having the same issue.

    import-module 'C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.Core.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.psd1'


    Joshua Fuente

    Thursday, December 27, 2012 9:15 PM
  • OK, so I still need help

    I am flipping between SMlets, and the SM Cmdlets, I removed all the modules, but still getting this error, going close the session and try again.

    PS C:\> $a = (get-module|%{$_.name}) -join " "
    PS C:\> $a
    
    PS C:\> Get-Module
    PS C:\> if(!$a.Contains("Microsoft.EnterpriseManagement.Core.Cmdlets")){Import-Module 'C:\Program Files\Microsoft System Center
    2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.Core.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.psd1' -E
    rrorVariable err -Force}
    Import-Module : The following error occurred while loading the extended type data file:
    Microsoft.PowerShell, C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.C
    ore.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml : File skipped because it was already present from "Micros
    oft.PowerShell".
    Microsoft.PowerShell, C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.C
    ore.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml : File skipped because it was already present from "Micros
    oft.PowerShell".
    Microsoft.PowerShell, C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.C
    ore.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml : File skipped because it was already present from "Micros
    oft.PowerShell".
    Microsoft.PowerShell, C:\Program Files\Common Files\SMLets\SMLets.Types.ps1xml(271) : Error in type "Microsoft.EnterpriseManage
    ment.Configuration.ManagementPackObjectTemplate": Member "ManagementPack" is already present.
    At line:1 char:78
    + if(!$a.Contains("Microsoft.EnterpriseManagement.Core.Cmdlets")){Import-Module <<<<  'C:\Program Files\Microsoft System Center
     2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.Core.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.psd1'
    -ErrorVariable err -Force}
        + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
        + FullyQualifiedErrorId : FormatXmlUpateException,Microsoft.PowerShell.Commands.ImportModuleCommand


    Joshua Fuente

    Thursday, December 27, 2012 9:59 PM
  • restarting the session fixed it... 

    Joshua Fuente

    • Marked as answer by Marcel Zehner Thursday, January 3, 2013 4:44 PM
    Thursday, December 27, 2012 10:30 PM