Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
***********
'*** Name: asf.vbs
'*** Purpose: To get or set ASF Configuration on a ASF Client.
'*** Usage: cscript.exe asf.vbs [/target:<systemname>] [/user:<username>] [/pass
word:<password>]
'*** Usage: [/enable:true|false] [/destinationip:<destinationip>] [/ping:true
|false]
'*** Usage: [/pinginterval:<interval>] [/heartbeat:true|false] [/heartbeatint
erval:<interval>]
'*** Usage: [/snmpcommunity:<snmpcommunity>] [/retrycount:<retrycount>] [/ret
ryinterval:<retryinterval>]
'***
'*** The /target switch is used to identify the target machine of the script. I
f /target is not
'*** specified, the script is applied to the local computer. If /target is spec
ified, the script
'*** is applied remotely to the target machine.
'*** The /user switch is used to specify a user account for the remote connectio
n
'***
'*** The /password switch is used to specify the password for the user account s
pecified by the
'*** /user switch. Note: The /password switch must be used with the /user swit
ch. You cannot specify
'*** a password without specifying a user.
'***
'*** The /enable:true switch turns ASF on. The /enable:false turns ASF off.
'*** Note: In order to successfully enable ASF, the destination IP and snmp com
munity must be set.
'***
'*** The /destinationip:<destinationip> switch tells the ASF what IP address to
send the PETs to.
'***
'*** The /ping:true switch enables the ASF to ping the destination IP at the int
erval specified in
'*** pinginterval. The /ping:false disables the ASF from pinging the destinatio
n IP.
'***
'*** The /pinginterval:<pinginterval> switch sets the interval between pings of
the destination IP.
'***
'*** The /heartbeat:true switch enables the ASF to send a heartbeat PET to the d
estination IP at
'*** the interval specified in heartbeatinterval. The /heartbeat:false disables
the ASF from sending
'*** heartbeat PETs to the destination IP.
'***
'*** The /heartbeatinterval:<heartbeatinterval> switch sets the interval between
sending PETs to
'*** the destination IP.
'***
'*** The /snmpcommunity:<snmpcommunity> switch sets the snmp community for the P
ETs.
'***
'*** The /retrycount:<retrycount> switch tells the ASF how many times to resend
the PETs to the
'*** destination IP address.
'***
'*** The /retryinterval:<retryinterval> switch sets the interval between resendi
ng the PETs to
'*** the destination IP.
'***
'***
'*** You can use any combination of the switches to set the configuration or you
can use no
'*** switches to retrieve the current configuration. The /target switch is alwa
ys used to identify
'*** the target machine to apply the script to.
'***
'***
'*** Examples of some typical uses of the script are below
'*** ===========================================================================
==========
'*** Example 1 This retrieves the current ASF configuration from the local mach
ine
'*** ----------
'*** cscript.exe asf.vbs
'***
'*** Example 2 This retrieves the current ASF configuration from a target machi
ne named "frank"
'*** by using the /target:frank, /user:steven, and /password:foo swit
ches
'*** ----------
'*** cscript.exe asf.vbs /target:frank /user:steven /password:foo
'***
'*** Example 3 This enables ASF on the local machine to send PETs, in the publi
c community,
'*** to ip address 10.1.1.5 by using the /enable:true, the /d
estinationip:10.1.1.5,
'*** and the /snmpcommunity:public switches.
'*** ----------
'*** cscript.exe asf.vbs /enable:true /destinationip:10.1.1.5 /snmpcommunity:pub
lic
'***
'*** Example 4 This enables ASF on a target machine named "frank" to send PETs,
in the public
'*** community, to ip address 10.1.1.5 by using the /target:f
rank, /user:steven,
'*** /password:foo, /enable:true, /destinationip:10.1.1.5, an
d /snmpcommunity:public switches.
'*** ----------
'*** cscript.exe asf.vbs /target:frank /user:steven /password:foo /enable:true /
destinationip:10.1.1.5 /snmpcommunity:public
'***
'*** ===========================================================================
===========
'*** The sample script is provided as an example only, and has not been tested,
nor is
'*** warranted in any way by Dell; Dell disclaims any liability in connection th
erewith.
'*** Dell provides no technical support with regard to such scripting. For more
information
'*** on WMI scripting, refer to applicable Microsoft documentation.
'***
'***
'*******************************************************************************
***********
Option Explicit
'*** Check that the right executable was used to run the script
'*** and that all parameters were passed
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Then
Call Usage()
WScript.Quit
End If
'*** Initialize variables
strNameSpace = "root/cimv2"
strClassName = "IA_ASF_OOBAlertService"
strKeyValue = "Intel ASF OOB Alert Service"
strComputerName = "localhost"
boolGet = TRUE
Dim i
for i = 0 to WScript.Arguments.Count-1
if Left(LCase(WScript.Arguments(i)), 8) = "/target:" then
strComputerName = Mid(WScript.Arguments(i), 9)
elseif Left(LCase(WScript.Arguments(i)), 6) = "/user:" then
strUserName = Mid(WScript.Arguments(i), 7)
elseif Left(LCase(WScript.Arguments(i)), 10) = "/password:" then
if (strUserName <> "") then
strPassword = Mid(WScript.Arguments(i), 11)
else
Call Usage()
WScript.Quit
end if
elseif Left(LCase(WScript.Arguments(i)), 8) = "/enable:" then
boolGet = FALSE
if LCase(Mid(WScript.Arguments(i), 9)) = "true" then
strPropEnableValue = 1
elseif LCase(Mid(WScript.Arguments(i), 9)) = "false" then
strPropEnableValue = 0
else
Call Usage()
Wscript.Quit
end if
elseif Left(LCase(WScript.Arguments(i)), 15) = "/destinationip:" then
boolGet = FALSE
strPropDestinationIPValue = Mid(WScript.Arguments(i), 16)
elseif Left(LCase(WScript.Arguments(i)), 6) = "/ping:" then
boolGet = FALSE
if LCase(Mid(WScript.Arguments(i), 7)) = "true" then
strPropPingEnableValue = 1
elseif LCase(Mid(WScript.Arguments(i), 7)) = "false" then
strPropPingEnableValue = 0
else
Call Usage()
Wscript.Quit
end if
elseif Left(LCase(WScript.Arguments(i)), 14) = "/pinginterval:" then
boolGet = FALSE
strPropPingIntervalValue = Mid(WScript.Arguments(i), 15)
elseif Left(LCase(WScript.Arguments(i)), 11) = "/heartbeat:" then
boolGet = FALSE
if LCase(Mid(WScript.Arguments(i), 12)) = "true" then
strPropHBEnableValue = 1
elseif LCase(Mid(WScript.Arguments(i), 12)) = "false" then
strPropHBEnableValue = 0
else
Call Usage()
Wscript.Quit
end if
elseif Left(LCase(WScript.Arguments(i)), 19) = "/heartbeatinterval:" the
n
boolGet = FALSE
strPropHBIntervalValue = Mid(WScript.Arguments(i), 20)
elseif Left(LCase(WScript.Arguments(i)), 15) = "/snmpcommunity:" then
boolGet = FALSE
strPropSnmpCommunityValue = Mid(WScript.Arguments(i), 16)
elseif Left(LCase(WScript.Arguments(i)), 12) = "/retrycount:" then
boolGet = FALSE
strPropRetryCountValue = Mid(WScript.Arguments(i), 13)
elseif Left(LCase(WScript.Arguments(i)), 15) = "/retryinterval:" then
boolGet = FALSE
strPropRetryIntervalValue= Mid(WScript.Arguments(i), 16)
else
Call Usage()
Wscript.Quit
end if
next
objInstance.Put_
'*** If any errors occurred, let the user know
If Err.Number <> 0 Then
WScript.Echo "Setting ASF Enable/Disable failed."
End If
Call GetASF()
Sub GetASF()
WScript.Echo VBCRLF & VBCRLF
If objInstance.Enable = true Then
if objInstance.SafeMode = true then
WScript.Echo "ASF Agent is in SAFE MODE! " & objInstance.ReasonF
orSafeMode
else
WScript.Echo "ASF Alerting Enabled: " & objInstance.Enab
le
WScript.Echo "ASF Trap Destination Address: " & objInstance.Dest
inationAddress
WScript.Echo "ASF SNMP Community: " & objInstance.SNMP
_Community
WScript.Echo "ASF Heartbeat Enabled: " & objInstance.Enab
lePresenceHeartbeats
WScript.Echo "ASF Heartbeat Interval: " & objInstance.Pres
enceHeartbeatInterval
WScript.Echo "ASF Ping Destination Enable: " & objInstance.Ping
AlertDestination
WScript.Echo "ASF Ping Interval: " & objInstance.Aler
tDestinationPingInterval
WScript.Echo "ASF Retry Count: " & objInstance.Retr
yCount
WScript.Echo "ASF Retry Interval: " & objInstance.Retr
yInterval
End if
Else
WScript.Echo "ASF Alerting Disabled"
End If
'*** If any errors occurred, let the user know
If Err.Number <> 0 Then
WScript.Echo "Setting ASF Enable/Disable failed."
End If
End Sub
WScript.Echo strMessage
End Sub