Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Const ForReading = 1 ' Open file read only Const ForWriting = 2 ' Open file read write Dim objFso, objFile, strFileName, strText, strNewText ' It might be nice at some point to get this via the environment variables strFileName = "C:\windows\system32\drivers\etc\hosts" Set objFso = CreateObject("Scripting.FileSystemObject") ' Open the File and read into string Set objFile = objFso.OpenTextFile(strFileName, ForReading) strText = objFile.ReadAll objFile.Close ' close the file ' Create a regular expression Dim re Set re = New RegExp re.Pattern = ".*srv01\.office\.local.*\n" re.IgnoreCase = True re.Global = True ' Add the entry strNewText = re.Replace(strText, "") strNewText = strNewText + "192.168.30.10 srv01.office.local" ' Write out file (deletes old file) Set ObjFile = objFSO.OpenTextFile(strFileName, ForWriting) objFile.WriteLine strNewText ' Write out the string contents objFile.Close ' Flush the DNS Cache so change will take effect Set WshShell = CreateObject("WScript.Shell") WshShell.Run "ipconfig /flushdns" MsgBox("Starter forbindelse til serveren - Vent venligst") WshShell.Run "ping -n 16 127.0.0.1 >NUL" WshShell.Run "C:\WINDOWS\system32\mstsc.exe /v:srv01.office.local /f"
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.