Windows 10 Initialize script on logoff and shutdown event

  • Thread starter Thread starter PratikAthavale
  • Start date Start date
P

PratikAthavale

Guest
We would like to initiate script which has user interaction at the time of logoff or/and shutdown event.

i tried with local GPO but unable to achieve the same

Below is the VB script,


intDepartmentChoice = 1
'create our Internet Explorer object for use with our script'
Set objInternetExplorer = WScript.CreateObject("InternetExplorer.Application", "MAINIE_")
objInternetExplorer.Navigate("about:blank")
objInternetExplorer.Document.Title = "Test Script Interface"
objInternetExplorer.ToolBar = 0
objInternetExplorer.StatusBar = 0
objInternetExplorer.Width = 300
objInternetExplorer.Height = 200
objInternetExplorer.Resizable = False
objInternetExplorer.Visible = True
'Create a paragraph and append it to Internet Explorer'
Set objMyParagraph = objInternetExplorer.document.createElement("P")
objMyParagraph.innerText = "What department do you work for?"
objInternetExplorer.document.body.appendChild(objMyParagraph)
'Create the selection list and its options'
Set objMySelectionList = objInternetExplorer.document.createElement("SELECT")
objMySelectionList.OnChange = GetRef("selectionUpdate")
Set objOptionAccounting = objInternetExplorer.document.createElement("OPTION")
objOptionAccounting.Text = "Accounting"
objOptionAccounting.Value = "1"
objMySelectionList.add(objOptionAccounting)
Set objOptionIt = objInternetExplorer.document.createElement("OPTION")
objOptionIt.Text = "Information Technology"
objOptionIt.Value = "2"
objMySelectionList.add(objOptionIt)
Set objOptionHr = objInternetExplorer.document.createElement("OPTION")
objOptionHr.Text = "Human Resources"
objOptionHr.Value = "3"
objMySelectionList.add(objOptionHr)
objInternetExplorer.document.body.appendChild(objMySelectionList)
'Create our Go button'
Set objMyButton = objInternetExplorer.document.createElement("BUTTON")
objMyButton.innerText = "Go!"
objMyButton.onclick = GetRef("cleanUpAndEndScript")
objInternetExplorer.document.body.appendChild(objMyButton)
Sub selectionUpdate()
intDepartmentChoice = Me.Value
End Sub
Sub cleanUpAndEndScript()
WScript.Echo "The selected value was: " & intDepartmentChoice
objInternetExplorer.Quit()
WScript.Quit()
End Sub
While True
WScript.Sleep(100)
Wend

More...
 
Back
Top