|
VBS脚本应用-starwind iscsi VBS连接脚本(2) WScript.quit End If On Error GoTo 0 strPort = Split(arrIPItem(intGroup),":",-1)(1)
oshell.Run "iscsicli AddTargetPortal "&strServerIP&" "&strPort,0,true oshell.Run "iscsicli LoginTarget "&strTargetPre & Right("000"&cNum,3)&" T * * * * * * * * * * * * * * * 0",0,true
Set WshNetwork=NoThing Set oshell=NoThing WScript.quit
Function GetIP(ComputerName) Dim objWMIService,colItems,objItem,objAddress Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objItem in colItems For Each objAddress in objItem.IPAddress If objAddress <> "" then GetIP = objAddress Exit For End If Next Next End Function
|