
How to check windows administrative privilege?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Re: How to check windows administrative privilege?
All the above VBScripts will not work if you disable your LAN connection from the system tray. 

-
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Re: How to check windows administrative privilege?
Hey, I've found a vbscript -
I put the above code into a vbs file & then run it; it just works very fine. But if I put it into rev custom property & try to execute, it says "execution error". I think it needs some modifications for using in rev. Someone pls, help me 
Code: Select all
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
strUser = objNetwork.UserName
isAdministrator = false
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser in objGroup.Members
If objUser.Name = strUser Then
isAdministrator = true
End If
Next
If isAdministrator Then
Wscript.Echo strUser & " is a local administrator."
Else
Wscript.Echo strUser & " is not a local administrator."
End If

Re: How to check windows administrative privilege?
I'm not sure that it will actually help, alemrantareq, but what happens if you delete "Set " from your script?
Best,
Mark
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Re: How to check windows administrative privilege?
Same problem 

Re: How to check windows administrative privilege?
Hi,
I think you need to remove Wscript.Echo because this is a kind of GUI element that RunRev can't work with. Just return the variable isAdministrator in the result.
Best,
Mark
I think you need to remove Wscript.Echo because this is a kind of GUI element that RunRev can't work with. Just return the variable isAdministrator in the result.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Re: How to check windows administrative privilege?
Yahooo !!! At last I've succeeded in the vbscript -
Just replaced the "Wscript.Echo" with "result =".
Now I think this one is the most accepted vbscript to check user administrative privileges both for them who have net connections or not.
Code: Select all
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
strUser = objNetwork.UserName
isAdministrator = false
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser in objGroup.Members
If objUser.Name = strUser Then
isAdministrator = true
End If
Next
If isAdministrator Then
result = "admin"
Else
result = "not admin"
End If
Now I think this one is the most accepted vbscript to check user administrative privileges both for them who have net connections or not.

Re: How to check windows administrative privilege?
Cool, Alemrantareq, and thanks for posting this. This is very useful for me.
Best,
Mark
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode