Thursday, 2 August 2012

PowerShell - Get SCCM related windows services.


Below is a quick single Powershell line I have created to display windows services that relate to the operations of SCCM. This command allows for a very quick remote view of the service running state of an SCCM site server.

Get-Service -computername $ServerName -include *SMS_*,ccmexec,w3svc,wdsserver,wsusservice,SQLServeragent

I have actually added the command line as a function into a .psm1 module file on our management server and  then published the Powershell console through RDS so others can benefit from this tool among others I have created. I would highly recommend others consider adding any Powershell 'tools' they create into a module on a terminal server and then publish the shell for others to use. I have found this to be a particularly useful approach in a large organisation.


File Path:
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\SCCM\SCCM.psm1

Function Get-SCCMServices {
    [CmdletBinding()]
    PARAM
    (
        [Parameter(Mandatory=$true, HelpMessage="SCCM Site Server",ValueFromPipeline=$true)] $ServerName
    ) 
            Get-Service -computername $ServerName -include *SMS_*,ccmexec,w3svc,wdsserver,wsusservice,SQLServeragent

 }


No comments:

Post a Comment