This is going to be one of very many scripts that I’m going to start uploading here. In another project I was tasked with designing a script that users were forced to agree to, or they would be logged off. It’s a very simple script and can be editted easily:
fMsg = “Welcome to the Network” + Chr(10)
Msg = msg & “By logging into this server you agree to the terms in the” + Chr(10)
Msg = msg & “IT Security guidelines which can be found at:” + vbLF
Msg = msg & “YOUR LOCATION HERE!” + vbLF
Msg = msg & “Do you agree?” + vbLF + vbLF + vbLF + vbLFstrMbox = MsgBox(Msg, vbYesNo + vbInformation, “Welcome!”)
if strMbox = 6 Then
WScript.Echo “Thank you for agreeing – Have a nice day!”
wscript.Quit
Else
For Each objPC In GetObject(“winmgmts:{(shutdown)}”).ExecQuery(“Select * from Win32_OperatingSystem”)
objPC.Win32Shutdown LOGOFF + FORCE
Next
End If
Let’s go over a few of the details.
- MSG: This is our message to display of course. You can see I’m adding it to itself to create a string.
- Chr(10): returns a linefeed character – This helps our message stay nice and clean.
- vbLF: Also represents a Line Feed Character – I used both so we could see them both in action.
- strMbox: This is the command to create our message box.
- vbInformation: Is for what buttons we want on our box. More here – link
- if strMbox = 6 – Yes returns a 6.
- objPC.Win32Shutdown LOGOFF + FORCE – Otherwise force a logoff.



