Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 7, 2016
0 parents
commit 97e20a7
Showing
187 changed files
with
5,688 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Set objArgs = WScript.Arguments | ||
strSMSServer = objArgs(0) | ||
strSiteToDisplay = objArgs(1) | ||
|
||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _ | ||
Loc.SiteCode) | ||
end if | ||
Next | ||
|
||
strInfo = "Site Boundary Informaiton for Site " & _ | ||
strSiteToDisplay & vbCRLF | ||
Set boundaries=objSMS.Get _ | ||
("SMS_SCI_SiteAssignment.SiteCode='" & _ | ||
strSiteToDisplay & "',Filetype=1,ItemName='" & _ | ||
"Site Assignment',ItemType='Site Assignment'") | ||
|
||
For i=0 to ubound(boundaries.AssignDetails) | ||
strInfo = strInfo & space(len(descr)) & _ | ||
boundaries.AssignTypes(i) & _ | ||
": " & boundaries.AssignDetails(i) & vbCRLF | ||
Next | ||
wscript.echo strInfo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
strSMSServer = <SMSServer> | ||
strSubnet = "10.5.123.0" 'replace with desired subnet | ||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _ | ||
Loc.SiteCode) | ||
strSMSSiteCode = Loc.SiteCode | ||
end if | ||
Next | ||
|
||
Set WbemContext=CreateObject("WbemScripting.SWbemNamedValueSet") | ||
WbemContext.Add "SessionHandle", objSMS.ExecMethod _ | ||
("SMS_SiteControlFile", "GetSessionHandle").SessionHandle | ||
objSMS.ExecMethod "SMS_SiteControlFile.Filetype=1,SiteCode='" _ | ||
& strSMSSiteCode & "'", "Refresh", , , WbemContext | ||
'retrieve boundary details | ||
Set WbemInst = objSMS.Get _ | ||
("SMS_SCI_SiteAssignment.Filetype=2,Itemtype='Site Assignment'," _ | ||
& "SiteCode='" & strSMSSiteCode & _ | ||
"',ItemName='Site Assignment'", , WbemContext) | ||
proparray1 = WbemInst.AssignDetails | ||
proparray2 = WbemInst.AssignTypes | ||
|
||
onemore = ubound(proparray1) + 1 | ||
redim preserve proparray1( onemore ) 'add one to size of array | ||
redim preserve proparray2( onemore ) | ||
proparray1( onemore ) = strSubnet | ||
proparray2( onemore ) = "IP Subnet" | ||
WbemInst.AssignDetails = proparray1 | ||
WbemInst.AssignTypes = proparray2 | ||
WbemInst.Put_ , WbemContext | ||
objSMS.ExecMethod "SMS_SiteControlFile.Filetype=0,SiteCode=""" & _ | ||
strSMSSiteCode & """", "Commit", , , WbemContext | ||
objSMS.Get("SMS_SiteControlFile").ReleaseSessionHandle _ | ||
WbemContext.Item("SessionHandle").Value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'adopted from the SMS 2003 Scenarios and Procedures guide | ||
strIPAddress = inputbox("Enter IP Address") | ||
strSubnetMask = inputbox("Enter Subnet Mask") | ||
|
||
dim addressbytes(4) | ||
dim subnetmaskbytes(4) | ||
i=0 | ||
period = 1 | ||
while period<>len( strIPAddress ) + 2 | ||
prevperiod=period | ||
period = instr( period+1, strIPAddress, "." ) + 1 | ||
if period = 1 then period = len( strIPAddress ) + 2 | ||
addressbyte = _ | ||
mid( strIPAddress, prevperiod, period-prevperiod-1 ) | ||
addressbytes(i)=addressbyte | ||
i=i+1 | ||
wend | ||
|
||
i=0 | ||
period = 1 | ||
while period<>len( strSubnetMask ) + 2 | ||
prevperiod=period | ||
period = instr( period+1, strSubnetMask, "." ) + 1 | ||
if period = 1 then period = len( strSubnetMask ) + 2 | ||
subnetmaskbyte = _ | ||
mid( strSubnetMask, prevperiod, period-prevperiod-1 ) | ||
subnetmaskbytes(i)=subnetmaskbyte | ||
i=i+1 | ||
wend | ||
for i=0 to 3 | ||
subnet = subnet & _ | ||
(addressbytes(i) AND subnetmaskbytes(i)) & "." | ||
next | ||
subnet = left( subnet, len(subnet)-1 ) | ||
msgbox "Subnet: " & subnet |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
strSMSServer = <SMSServer> | ||
strADSite = "Cleveland" | ||
|
||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _ | ||
Loc.SiteCode) | ||
strSMSSiteCode = Loc.SiteCode | ||
end if | ||
Next | ||
|
||
Set WbemContext=CreateObject("WbemScripting.SWbemNamedValueSet") | ||
WbemContext.Add "SessionHandle", objSMS.ExecMethod _ | ||
("SMS_SiteControlFile", "GetSessionHandle").SessionHandle | ||
objSMS.ExecMethod "SMS_SiteControlFile.Filetype=1,SiteCode='" _ | ||
& strSMSSiteCode & "'", "Refresh", , , WbemContext | ||
'retrieve boundary details | ||
Set WbemInst = objSMS.Get _ | ||
("SMS_SCI_SiteAssignment.Filetype=2,Itemtype='Site Assignment'," _ | ||
& "SiteCode='" & strSMSSiteCode & _ | ||
"',ItemName='Site Assignment'", , WbemContext) | ||
proparray1 = WbemInst.AssignDetails | ||
proparray2 = WbemInst.AssignTypes | ||
|
||
onemore = ubound(proparray1) + 1 | ||
redim preserve proparray1( onemore ) 'add one to size of array | ||
redim preserve proparray2( onemore ) | ||
proparray1( onemore ) = strADSite | ||
proparray2( onemore ) = "Active Directory site" | ||
WbemInst.AssignDetails = proparray1 | ||
WbemInst.AssignTypes = proparray2 | ||
WbemInst.Put_ , WbemContext | ||
objSMS.ExecMethod "SMS_SiteControlFile.Filetype=0,SiteCode=""" & _ | ||
strSMSSiteCode & """", "Commit", , , WbemContext | ||
objSMS.Get("SMS_SiteControlFile").ReleaseSessionHandle _ | ||
WbemContext.Item("SessionHandle").Value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
Set objArgs = WScript.Arguments | ||
strSMSServer = objArgs(0) | ||
strSiteToConfig= objArgs(1) | ||
strBoundaryType = ucase(objArgs(2)) | ||
strBoundaryData = objArgs(3) | ||
'creating 2 arrays of size one | ||
Dim inputArray1(1) | ||
Dim inputArray2(1) | ||
|
||
select case strBoundaryType | ||
case "SUBNET" | ||
strBoundaryType = "IP Subnet" | ||
case "AD" | ||
strBoundaryType = "Active Directory site" | ||
End Select | ||
|
||
inputArray1(0) = trim(strBoundaryData) | ||
inputArray2(0) = trim(strBoundaryType) | ||
|
||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSWbemServices = objLoc.ConnectServer _ | ||
(Loc.Machine, "root\sms\site_" & Loc.SiteCode) | ||
end if | ||
Next | ||
|
||
|
||
Set objSWbemContext=CreateObject _ | ||
("WbemScripting.SWbemNamedValueSet") | ||
objSWbemContext.Add "SessionHandle", _ | ||
objSWbemServices.ExecMethod("SMS_SiteControlFile", _ | ||
"GetSessionHandle").SessionHandle | ||
objSWbemServices.ExecMethod _ | ||
"SMS_SiteControlFile.Filetype=1,Sitecode='" & _ | ||
strSiteToConfig & "'", "RefreshSCF", , , objSWbemContext | ||
Set objSWbemInst = objSWbemServices.Get _ | ||
("SMS_SCI_SiteAssignment.Filetype=2,Itemtype='" & _ | ||
"Site Assignment',Sitecode='" & strSiteToConfig & _ | ||
"',ItemName='Site Assignment'", , objSWbemContext) | ||
|
||
'Retrieve the boundary details. | ||
proparray1 = objSWbemInst.AssignDetails | ||
proparray2 = objSWbemInst.AssignTypes | ||
|
||
if ubound(objSWbemInst.AssignDetails)=-1 then | ||
'There are no boundaries so create an array. | ||
bounds=0 | ||
redim proparray1(0) | ||
redim proparray2(0) | ||
proparray1(bounds)=inputArray1(0) | ||
proparray2(bounds)=inputArray2(0) | ||
Else | ||
bounds=ubound (objSWbemInst.AssignDetails)+1 | ||
'Increase array for new boundaries | ||
ReDim Preserve proparray1 (ubound (proparray1) + _ | ||
ubound (inputArray1)) | ||
ReDim Preserve proparray2 (ubound (proparray2) + _ | ||
ubound (inputArray2)) | ||
for i= 0 to ubound(inputArray1)-1 'Add boundaries | ||
proparray1(bounds+i)=inputArray1(i) | ||
proparray2(bounds+i)=inputArray2(i) | ||
Next | ||
End If | ||
|
||
objSWbemInst.AssignDetails = proparray1 | ||
objSWbemInst.AssignTypes = proparray2 | ||
objSWbemInst.Put_ , objSWbemContext | ||
|
||
objSWbemServices.ExecMethod _ | ||
"SMS_SiteControlFile.Filetype=0,Sitecode=""" & _ | ||
strSiteToConfig & """", "Commit", , , objSWbemContext | ||
objSWbemServices.Get("SMS_SiteControlFile"). _ | ||
ReleaseSessionHandle objSWbemContext.Item _ | ||
("SessionHandle").Value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Set objArgs = WScript.Arguments | ||
strSMSServer = objArgs(0) | ||
strSiteToDisplay = ucase(objArgs(1)) | ||
|
||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _ | ||
Loc.SiteCode) | ||
end if | ||
Next | ||
|
||
strInfo = "Roaming Site Boundary Informaiton for Site " & _ | ||
strSiteToDisplay & vbCRLF | ||
|
||
Set boundaries=objSMS.Get("SMS_SCI_RoamingBoundary." & _ | ||
"SiteCode='" & strSiteToDisplay & "',Filetype=2,ItemName='" & _ | ||
"Roaming Boundary',ItemType='Roaming Boundary'") | ||
if boundaries.IncludeSiteBoundary then | ||
strInfo = strInfo & "Site Boundaries are included in the "& _ | ||
"local roaming boundaries." & vbCRLF | ||
else | ||
strInfo = strInfo & "Site Boundaries are NOT included in the "& _ | ||
"local roaming boundaries." & vbCRLF | ||
end if | ||
msgbox ubound(boundaries.Details) | ||
For i=0 to ubound(boundaries.Details) | ||
if boundaries.Flags(i) = 1 then | ||
strBoundary = "Remote Boundary" | ||
else | ||
strBoundary = "Local Boundary" | ||
end if | ||
strInfo = strInfo & _ | ||
boundaries.Types(i) & _ | ||
": " & boundaries.Details(i) & vbTAB & strBoundary & vbCRLF | ||
Next | ||
wscript.echo strInfo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Set objArgs = WScript.Arguments | ||
strSMSServer = objArgs(0) | ||
strSiteToModify = objArgs(1) | ||
strBoundaryType = ucase(objArgs(2)) | ||
strBoundaryData = objArgs(3) | ||
strRemote = ucase(objArgs(4)) | ||
Dim inputArray1(1) | ||
Dim inputArray2(1) | ||
Dim inputArray3(1) | ||
|
||
select case strBoundaryType | ||
case "SUBNET" | ||
strBoundaryType = "IP Subnets" | ||
case "AD" | ||
strBoundaryType = "AD Site Name" | ||
case "RANGE" | ||
strBoundaryType = "IP Ranges" | ||
End Select | ||
|
||
select case strRemote | ||
case "LOCAL" | ||
strRemote = 0 | ||
case "REMOTE" | ||
strRemote = 1 | ||
end select | ||
inputArray1(0)=strBoundaryData | ||
inputArray2(0)=strRemote | ||
inputArray3(0)=strBoundaryType | ||
|
||
|
||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _ | ||
Loc.SiteCode) | ||
end if | ||
Next | ||
|
||
Set objSWbemContext = CreateObject _ | ||
("WbemScripting.SWbemNamedValueSet") | ||
objSWbemContext.Add "SessionHandle", _ | ||
objSMS.ExecMethod("SMS_SiteControlFile", _ | ||
"GetSessionHandle").SessionHandle | ||
objSMS.ExecMethod _ | ||
"SMS_SiteControlFile.Filetype=1,Sitecode='" & _ | ||
strSiteToModify & "'", "RefreshSCF", , , objSWbemContext | ||
Set objSWbemInst = objSMS.Get _ | ||
("SMS_SCI_RoamingBoundary.Filetype=2,Itemtype='" & _ | ||
"Roaming Boundary',Sitecode='" & strSiteToModify & _ | ||
"',ItemName='Roaming Boundary'", , objSWbemContext) | ||
|
||
'Retrieve the roaming boundary details. | ||
proparray1 = objSWbemInst.Details | ||
proparray2 = objSWbemInst.Flags | ||
proparray3 = objSWbemInst.Types | ||
|
||
if ubound(objSWbemInst.Details)=-1 then | ||
'There are no boundaries so create an array. | ||
bounds=0 | ||
redim proparray1(0) | ||
redim proparray2(0) | ||
redim proparray3(0) | ||
proparray1(bounds)=inputArray1(0) | ||
proparray2(bounds)=inputArray2(0) | ||
proparray3(bounds)=inputArray3(0) | ||
Else | ||
bounds=ubound (objSWbemInst.Details)+1 | ||
'Increase array for new boundaries | ||
ReDim Preserve proparray1 (ubound (proparray1) + _ | ||
ubound (inputArray1)) | ||
ReDim Preserve proparray2 (ubound (proparray2) + _ | ||
ubound (inputArray2)) | ||
ReDim Preserve proparray3 (ubound (proparray3) + _ | ||
ubound (inputArray3)) | ||
for i= 0 to ubound(inputArray1)-1 'Add boundaries | ||
proparray1(bounds+i)=inputArray1(i) | ||
proparray2(bounds+i)=inputArray2(i) | ||
proparray3(bounds+i)=inputArray3(i) | ||
Next | ||
End If | ||
|
||
objSWbemInst.Details = proparray1 | ||
objSWbemInst.Flags = proparray2 | ||
objSWbemInst.Types = proparray3 | ||
objSWbemInst.Put_ , objSWbemContext | ||
|
||
objSMS.ExecMethod _ | ||
"SMS_SiteControlFile.Filetype=0,Sitecode=""" & _ | ||
strSiteToModify & """", "Commit", , , objSWbemContext | ||
objSMS.Get("SMS_SiteControlFile"). _ | ||
ReleaseSessionHandle objSWbemContext.Item _ | ||
("SessionHandle").Value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
strSMSServer = <SMSServer> | ||
strCollID = "LAB0002B" | ||
|
||
Set objLoc = CreateObject("WbemScripting.SWbemLocator") | ||
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms") | ||
Set Results = objSMS.ExecQuery _ | ||
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true") | ||
For each Loc in Results | ||
If Loc.ProviderForLocalSite = True Then | ||
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _ | ||
Loc.SiteCode) | ||
end if | ||
Next | ||
|
||
Set Token = objSMS.Get("SMS_ST_RecurInterval") | ||
Token.DaySpan = 1 | ||
Token.StartTime = "20051202103000.000000+***" 'wmi date-string | ||
'If omitted, StartTime = Jan 1, 1990 - this shouldn't | ||
'cause any issues | ||
Set objCollection = objSMS.Get _ | ||
("SMS_Collection.CollectionID='" & strCollID & "'") | ||
objCollection.RefreshSchedule = Array(Token) | ||
objCollection.RefreshType = 2 'Periodic refresh | ||
objCollection.Put_ |
Oops, something went wrong.