Created
February 15, 2014 13:31
-
-
Save Nora-Ballard/9019382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SCCMSiteMode($ComputerName) | |
{ | |
if ( $(Get-Service -Name CcmExec -ComputerName $ComputerName -ErrorAction SilentlyContinue) ) | |
{ | |
try { $CCM_ClientSiteMode = Get-WmiObject -Namespace 'ROOT\ccm' CCM_ClientSiteMode -ComputerName $ComputerName -EA SilentlyContinue } | |
catch { $CCM_ClientSiteMode = $NULL} | |
if ($CCM_ClientSiteMode) | |
{ | |
$SiteModes = @{ | |
'0' = 'Unknown' | |
'1' = 'Mixed Mode' | |
'2' = 'Native Mode' | |
} | |
if ($CCM_ClientSiteMode.SiteMode.ToString() -eq $null) { $SiteModeText = 'Not Available' } | |
else { $SiteModeText = $SiteModes[$CCM_ClientSiteMode.SiteMode.ToString()] } | |
} | |
else | |
{ | |
Write-Warning "Could not connect to WMI class CCM_ClientSiteMode on '$ComputerName'." | |
$SiteModeText = 'Not Available' | |
} | |
} | |
else | |
{ | |
Write-Warning "Could not find 'CcmExec' service. SCCM Client is not available." | |
$SiteModeText = 'No Client' | |
} | |
Write-Verbose "SCCM SiteMode:`t$($SiteModeText)" | |
Write-Output $SiteModeText | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment