Jump to content

my first script


Guest eskimo

Recommended Posts

Guest eskimo

Hi Allthis is my firsy script i need to refresh ip at workstation at work.so i made this script that does :ipconfig /releaseipconfig /renewipconfig /flushdnsnbtstat –RRIpconfig /RegisterdnsPing 10.10.1.17but it looks like i write it a little worng and that nbtstat -RR doesnt work.can somewone please help me finish it thx On Error Resume NextDim AdapterConfigDim RetValDim xDim yDim aDim b Dim cDim d Set AdapterConfig = GetObject("winmgmts:Win32_NetworkAdapterConfiguration")'WMI release IP Address RetVal = AdapterConfig.ReleaseDHCPLeaseAll If RetVal = 0 Then x = "1. Ipconfig Release Success." Else x = "1. Ipconfig Release Fail." End If 'WMI renew ip Address RetVal = AdapterConfig.RenewDHCPLeaseAll If RetVal = 0 Then y = "2. Ipconfig Renew Success." Else y = "2. Ipconfig Renew Fail." End If 'ipconfig /flushdnsstrCommand = "ipconfig /flushdns"set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run(strCommand, 0, TRUE) if intRC <> 0 then a = "3. Flushdns As Fail" & intRC else a = "3. Flushdns Executed Success." End If 'Nbtstat–RRstrCommand = "nbtstat –RR"Set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run(strCommand, 0, TRUE) if intRC <> 0 then b = "4. Nbtstat As Fail." & intRC else b = "4. Nbtstat Executed Success." end If 'Ipconfig /RegisterdnsstrCommand = "ipconfig /Registerdns"Set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run(strCommand, 0, TRUE) if intRC <> 0 then c = "5. Flushdns As Fail" & intRC else c = "5. Flushdns Executed Success." end If'Ping 10.10.1.17strCommand = "ping 10.10.1.17"Set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run(strCommand, 0, TRUE) if intRC <> 0 then d = "6. Ping As Fail" & intRC else d = "6. Ping Executed Success." End ifSet AdapterConfig = NothingMsgBox x & vbCrLf & vbCrLf & y & vbCrLf & vbCrLf & a & vbCrLf & vbCrLf & b & vbCrLf & vbCrLf & c & vbCrLf & vbCrLf & d[/b]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...