$sccmsrv= "CM01"
$site = (gwmi -ComputerName $sccmsrv -Namespace root\sms `
-Class SMS_ProviderLocation).sitecode
# enumerating SQL server name for the given SCCM site server
$sccmCompquery = gwmi -q "Select distinct SiteSystem, Role, `
SiteCode FROM SMS_SiteSystemSummarizer where role = `
'SMS SQL Server' and siteCode = '$site' ORDER BY SiteCode" `
-namespace "root\sms\site_$site" -ComputerName $sccmsrv
[string]$tmpstr = `
[regex]::Match($sccmCompquery.sitesystem, "\\\\w+\\$")
$tmpstr = ($sccmCompquery.SiteSystem).SubString([regex]::Match( `
$sccmCompquery.SiteSystem, "]\\").Index + 3)
$sccmSQLServer = $tmpstr.replace("\", "")
$sccmDB = "CM_$site"
$site = (gwmi -ComputerName $sccmsrv -Namespace root\sms `
-Class SMS_ProviderLocation).sitecode
# enumerating SQL server name for the given SCCM site server
$sccmCompquery = gwmi -q "Select distinct SiteSystem, Role, `
SiteCode FROM SMS_SiteSystemSummarizer where role = `
'SMS SQL Server' and siteCode = '$site' ORDER BY SiteCode" `
-namespace "root\sms\site_$site" -ComputerName $sccmsrv
[string]$tmpstr = `
[regex]::Match($sccmCompquery.sitesystem, "\\\\w+\\$")
$tmpstr = ($sccmCompquery.SiteSystem).SubString([regex]::Match( `
$sccmCompquery.SiteSystem, "]\\").Index + 3)
$sccmSQLServer = $tmpstr.replace("\", "")
$sccmDB = "CM_$site"
Ingen kommentarer:
Legg inn en kommentar