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"> </td>
<td>
<input class="button-150" type='submit' onClick='logOff'
value='Log Off the Kiosk'>
</td>
</tr>
</table>
</BODY>
</HTML>
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"> </td>
<td>
<input class="button-150" type='submit' onClick='logOff'
value='Log Off the Kiosk'>
</td>
</tr>
</table>
</BODY>
</HTML>