Logoff script

M

Mike

Hi All

We are using the code below attached to a button on a web page to perform a
logoff. We get the following error message:

ActiveX component can't create object 'WbemScripting.SWbemLocator'

Any idea why? I'm logged into the client machine with admin rights.

Cheers

Mike

<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="/StyleSheets/dtr.css">
<link rel="stylesheet" type="text/css"
href="/StyleSheets/gnmmain.css">
</HEAD>

<script language="vbscript">
function logOff()
If Msgbox("Are you sure that you want to completely Log Off this
PC?", vbYesNo Or vbQuestion, "Confirm Log Off") = vbYes Then
Dim Connection, WQL, SystemClass, System

'Get connection To remote wmi
Dim Locator
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Set Connection = Locator.ConnectServer(, "root\cimv2")
Connection.Security_.impersonationlevel = 3
Connection.Security_.Privileges.Add 18
'Connection.Security_.Privileges.Add 23

'Get Win32_OperatingSystem objects - only one object In the
collection
WQL = "Select Name,CSName,WindowsDirectory From
Win32_OperatingSystem"
Set SystemClass = Connection.ExecQuery(WQL)

'Get one system object
'I think there is no way To get the object using URL?
For Each System In SystemClass
MsgBox ("Name : " & System.Name & vbCrLf & "CSName : " &
System.CSName & vbCrLf & "WindowsDirectory : " & System.WindowsDirectory)
'System.Win32ShutDown (0)
System.Win32ShutDown (4)
Next
Else
Msgbox "If you are not using the Kiosk account, you can simply
close the Web Browser to leave the Kiosk.", vbInformation, "Log Off Cancelled"
End If

end function


</script>

<BODY>
<br>
<table border="0">
<tr>
<td width="10">&nbsp;</td>
<td>
<input class="button-150" type='submit' onClick='logOff'
value='Log Off the Kiosk'>
</td>
</tr>
</table>


</BODY>
</HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top