Set WshShell = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Echo "Error: No windows version provided. Please pass the windows version as a parameter."
    WScript.Quit
End If

MsgBox "Don't restart your computer after leaving Azure AD. Please proceed with the Profwiz Manager script instructions.", vbOKOnly + vbInformation, "Domain disconnect"

Dim WinVer
WinVer = WScript.Arguments(0)

If WinVer = "Win10" Then
WshShell.Run "ms-settings:workplace"
WScript.Sleep 3000
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
End If

If WinVer = "Win11" Then
WshShell.Run "ms-settings:workplace"
WScript.Sleep 3000
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
End If