Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


run script with administrator's right ?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,39351
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> run script with administrator's right ?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 run script with administrator's right ? - 11/1/2006 7:12:59 PM   
  andrewli

 

Posts: 3
Score: 0
Joined: 12/13/2005
Status: offline
here is my logon script code

Set objWshNet = CreateObject("Wscript.Network")
strCN = lcase(objWshNet.ComputerName)
strCU = lcase(objWshNet.UserName)
Set objGroup = GetObject("WinNT://" & strCN & "/Administrators")
Set objUser = GetObject("WinNT://kill.com/" & StrCU )
objGroup.Add(objUser.ADsPath)

i want set this script with group policy , when user logon their computer
this script can add this logon user to administrator group

here is my problem ~~~  all user in my domain just domain user , how can i set
that when user logon and run this script that can add users to local administrator group without administrator's right ?




 
 
Post #: 1
 
 RE: run script with administrator's right ? - 11/1/2006 8:35:40 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
I'm not sure what your trying to do. Does this help
There are two different scripts here.

      

< Message edited by gdewrance -- 11/19/2006 5:15:26 PM >

(in reply to andrewli)
 
 
Post #: 2
 
 RE: run script with administrator's right ? - 11/1/2006 9:01:10 PM   
  andrewli

 

Posts: 3
Score: 0
Joined: 12/13/2005
Status: offline
thanks your help

when i run first script to add local administrator groups , you must be a admin to run this script

but my question is ,

i want that when i run this script to add local administrator groups , i am not a admin members , just a user

(in reply to gdewrance)
 
 
Post #: 3
 
 RE: run script with administrator's right ? - 11/1/2006 9:37:54 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
then you will need to search the forum for runas.
If you do not have admin rights, then ask your administrator. or are you trying to give yourself admin privileges?

< Message edited by gdewrance -- 11/1/2006 9:42:12 PM >

(in reply to andrewli)
 
 
Post #: 4
 
 RE: run script with administrator's right ? - 11/2/2006 2:12:57 AM   
  SAPIENScripter


Posts: 271
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
I'm assuming you don't want to give all domain uses admin rights, just the user logging on.  Do multiple people logon to a specific computer or do you know that user Jane always and only logs on to computer XP01?  To add a user to the local administrator's group you can use a script and run it as a computer startup script.  However, you would need to somehow pass it the name of the user who will be logging on. 

One idea that comes to mind is to put the username in the description of the computer object. Your computer start up script would get the description and add the user to the local administrator's group.  You could even put in multiple users and separated by commas and parse the description as an array.


Once you know the name you want to add, here's another script that will add it to the local administrator's group if it doesn't already exist.

      
Running the script as a computer startup script will get the job done.  The trick is finding a creative way to specify the user(s) as a run time parameter.

_____________________________

Jeffery Hicks
Windows PowerShell MVP
SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com

Follow Me: http://www.twitter.com/JeffHicks

(in reply to gdewrance)
 
 
Post #: 5
 
 RE: run script with administrator's right ? - 11/16/2006 3:36:28 AM   
  BigKidd1310

 

Posts: 2
Score: 0
Joined: 11/16/2006
Status: offline
I'm having a similar problem with some of our computers. We recently found a potentially harmful service running on many computers across our network and we have created a script which will search for this service and the files associated with it and if found delete them. The problem we have is that since many of our users are students we have one account they login to which is severly restricted on the actions they can perform. The script is set to run at login, however if it finds the file and service it attempts to delete them and we get a "Permission Denied" error message for our script.

I read the other replies in this topic but wanted to see if anyone knew a way so that the script when it ran would authenticate itself and make the computer believe it is the administrator running the script, rather than the user. This would save us from having to add this account, as well as individual accounts across the network,(even temporarily) to the Local Admin group.

Is it clear what I am asking? If not let me know and I'll try to rephrase or provide some more info on the situation. Thanks in advance for your help.   

(in reply to SAPIENScripter)
 
 
Post #: 6
 
 RE: run script with administrator's right ? - 11/19/2006 5:07:25 PM   
  netxman

 

Posts: 99
Score: 0
Joined: 8/1/2005
Status: offline
I think there is only one way to do that as I used.

One way has two choices. One is Runas. Another is PsExec.

Because Runas can not get the password input so I prefer PsExec.The premise is you should have an administrator account on that PC.


(in reply to BigKidd1310)
 
 
Post #: 7
 
 RE: run script with administrator's right ? - 11/20/2006 12:19:25 AM   
  BigKidd1310

 

Posts: 2
Score: 0
Joined: 11/16/2006
Status: offline
We would like to be able to do this without administrator input since it would take a long time to login to each computer. Can runas accomplish this?

(in reply to netxman)
 
 
Post #: 8
 
 RE: run script with administrator's right ? - 11/20/2006 12:30:33 PM   
  netxman

 

Posts: 99
Score: 0
Joined: 8/1/2005
Status: offline
The purpose of using script is to avoid login to each computer.

(in reply to BigKidd1310)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> run script with administrator's right ? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts