Jump to content

Boston2012

Member
  • Posts

    8
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About Boston2012

Profile Information

  • OS
    Server 2008 x86

Boston2012's Achievements

0

Reputation

  1. Thanks for the reply. I'm still learning all this VB Scripting on the fly here, can you tell me where to add this data in my script? See below:
  2. Below is copy of script I'm using, the .csv file that shows results is showing "False" and should be showing "True". Any ideas why this is happening? I am able to manually ping 172.24.72.155 and getting replies. 'Option Explicit On Error Resume Next Dim strNewContents, strLine, objFile,SuccessFile,strSuccessFlag,SuccessCode,strCritcalFlag,CriticalFile Dim objShell,strOS Set objFSO = CreateObject("Scripting.FileSystemObject") Set objNetwork = CreateObject("WScript.Network") Set objShell = CreateObject("WScript.Shell") ' Constants Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 strThisComputer = objNetwork.ComputerName strFileOutput = "C:\TJXLogs\" & KMSPing & "KMSPing.csv" strSuccessFlag = "C:\TJXLogs\Success.flag" strOS = objShell.ExpandEnvironmentStrings("Win32_OperatingSystem") 'Determine Operating System for each objOS in GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem") strOS=objOS.Caption next If LCase(strOS) = RTrim(LCase("Microsoft Windows 2000 Server")) Then strOS = "Windows 2000" ElseIf LCase(strOS) = Rtrim(LCase("Microsoft Windows Server 2008 Standard")) Then strOS = "Windows 2008" Else strOS = "Windows 2008" End If If objFSO.FileExists(strFileOutput) Then Set objOutputFile = objFSO.OpenTextFile (strFileOutput, ForWriting) Else Set objOutputFile = objFSO.CreateTextFile(strFileOutput, True) End If If Err <> 0 Then Wscript.Echo "Unable to open " & strFileOutput & " for output." WScript.Quit End If If objFSO.FileExists(strFileOutput) Then Set objOutputFile = objFSO.OpenTextFile (strFileOutput, ForWriting) Else Set objOutputFile = objFSO.CreateTextFile(strFileOutput, False) End If strTarget = "172.24.72.155" If Ping(strTarget) = True Then strResult = "True" set objsuccessflag = objFSO.CreateTextFile(strSuccessFlag, False) Else strResult = "False" End If strFileOutput = "C:\TJXLogs\" & KMSPing & "KMSPing.csv" Set objFSO = CreateObject("Scripting.FileSystemObject") objOutputFile.Write """" & strThisComputer & """,""" & StrOS & """,""" & strResult & """,""" & Now & """"& vbcrlf objInFile.Close objOutFile.Close Function Ping(strComputer) Dim objShell, boolCode Set objShell = CreateObject("WScript.Shell") boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True) If boolCode = 0 Then Ping = True Else Ping = False End If End Function
  3. Were trying to merge the results.csv file into one .csv file. Does anyone know how I can update the results.csv in the script to include a new line at the end?
  4. Thanks, that did work. Anyway to abbreviate the output to show just: Windows 2000 Windows 2008
  5. Hello, I'm trying to edit my script to add another field in the.CSV file to indicate if OS is Windows 2000 or Windows 2008. Win I run this on either a 2K or 08 system the .CSV file is showing "Windows_NT" , can you tell me where I'm going wrong with this. Copy of scrip is below: 'Option Explicit On Error Resume Next Dim strNewContents, strLine, objFile,SuccessFile,strSuccessFlag,SuccessCode,strCritcalFlag,CriticalFile Dim objShell,strOS Set objFSO = CreateObject("Scripting.FileSystemObject") Set objNetwork = CreateObject("WScript.Network") Set objShell = CreateObject("WScript.Shell") ' Constants Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 strThisComputer = objNetwork.ComputerName strFileOutput = "C:\TJXLogs\" & KMSPing & "KMSPing.csv" strSuccessFlag = "C:\TJXLogs\Success.flag" strOS = objShell.ExpandEnvironmentStrings("%OS%") If objFSO.FileExists(strFileOutput) Then Set objOutputFile = objFSO.OpenTextFile (strFileOutput, ForWriting) Else Set objOutputFile = objFSO.CreateTextFile(strFileOutput, True) End If If Err <> 0 Then Wscript.Echo "Unable to open " & strFileOutput & " for output." WScript.Quit End If If objFSO.FileExists(strFileOutput) Then Set objOutputFile = objFSO.OpenTextFile (strFileOutput, ForWriting) Else Set objOutputFile = objFSO.CreateTextFile(strFileOutput, False) End If strTarget = "172.24.72.155" If Ping(strTarget) = True Then strResult = "True" set objsuccessflag = objFSO.CreateTextFile(strSuccessFlag, False) Else strResult = "False" End If strFileOutput = "C:\TJXLogs\" & KMSPing & "KMSPing.csv" Set objFSO = CreateObject("Scripting.FileSystemObject") objOutputFile.Write """" & strThisComputer & """,""" & StrOS & """,""" & strResult & """,""" & Now & """" objOutputFile.Close Function Ping(strComputer) Dim objShell, boolCode Set objShell = CreateObject("WScript.Shell") boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True) If boolCode = 0 Then Ping = True Else Ping = False End If End Function
  6. I need to create a VB Script to ping a specific IP address from every existing server in our network to confirm the store's firewall rules are correct to talk to the KMS server in preparation for the upgrade to Windows 2008. The IP address to ping is 172.xx.xx.xxx I need this script to ping the IP, capture the results, and bring the results back to RemoteWare where they can be organized into a consolidated report .csv file. "ServerName", "Result", "Date/Time" The Result should be True for Ping Response Received and False for No Ping Reponse received. The ServerName should be the Controller computer name. Does anyone already have something like this available?
  7. I need to write a VB Script that would ping a specific IP address from every existing 08 Server to confirm the store firewall rules are correct to talk to the KMS server in preparation for the upgrade to Windows 2008. The IP address is 172.XX.XX.XXX

    I need the script to ping the IP, capture the results and bring results back to a system on the network. in a .csv file. Can anyone he...

×
×
  • Create New...