473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Logoff script

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>
Mar 30 '06 #1
0 1568

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Arun Goel | last post by:
Hi all, I have set up rmiregistry.exe to run as service on Windows 2000 Server .. I set it up using "srvany.exe". It is running fine, but when I logoff, it stops.I did a lot of research but I...
8
by: Jonathan Heath | last post by:
Hi all, I have created an ASP script that enters data into an Access Database. My problem is that I'd like this script to run when the computer is shutdown or the user logs off. I think...
7
by: JonBoy | last post by:
Is it possible to put the logoff/shutdown/restart buttons on an ASP page or something similar? If so can anyone point me in the direction of some code please or where I can read how to do it ...
2
by: Michael | last post by:
Hi, I was creating a trigger to fire when a user ends a session, but I see that you could have it fire on a SCHEMA event : CREATE TRIGGER "SRU"."TEST" BEFORE LOGOFF ON "SRU".SCHEMA or a...
8
by: Jm | last post by:
Hi All I have an app that when running if a user selects logoff or shutdown from the start menu, it will close itself but not logoff windows or shutdown. From what i have found so far its most...
1
by: mikemiller.innova | last post by:
I have a C# Windows App for reporting server changes. I want my C# Windows App to be able to launch when someone tries to logoff so they are forced to log what they did before the system logs...
2
by: mikemiller.innova | last post by:
I developed a C# Windows App that requires a user to input their real name and what they did to the server while they were online. I am going to launch the app att shutdown via a logoff script. ...
6
by: =?Utf-8?B?Zmh1bnRlcg==?= | last post by:
Hi I have a small .net Windows app that I need to run before the user logs off the machine. This is a Windows App where a dialog is displayed to the user and he/she needs to answer before the...
3
by: =?Utf-8?B?Zmh1bnRlcg==?= | last post by:
I have a Windows Service that should pop a windows form right before logoff, for the user to enter some information. I got things working fairly well except that the user does not get to see the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.