Solved

Needing GPO (scripts (logon/logoff)) to run with administrator rights

Posted on 2008-06-13
8
2,921 Views
Last Modified: 2008-06-24
How can I get Group Policy (scripts (logon/logoff)) to run with administrator rights?
0
Comment
Question by:ei00004
  • 3
  • 3
8 Comments
 
LVL 6

Expert Comment

by:raptorjb007
Comment Utility
There are four types of scripts that can be configured in GPO.

Computer: Startup & Shutdown
User: Logon & Logoff

Out of these four types, only the user logon script type runs as the user, the other three run as LocalSystem. If LocalSystem rights are not enough, you could incorporate a script that elevates itself using the runas command, however this would be insecure due to the fact that the password would be stored unencrypted in the script, and to run the user would require read access to the script itself thus creating the possibility for users to obtain admin credentials.

What is it you are trying to script that requires admin rights? Perhaps there is a way to accomplish the task with a limited access account.
0
 

Author Comment

by:ei00004
Comment Utility
Thanks for the explantion, I have changed the script to run as Startup in the GPO, but I'm still not sure it is executing on the client pc. I only need to execute a simple batch file that copies a (.ini) file from a shared folder on the server to a folder on the client PC's C:\ drive. I need to check a few client PC's to verify the file has been copied there.

I also need to run a kixtart script using AdminScriptEditor (ASE) as administrator to change the printers on the client pc's from one print server to another. I know I can use the runas command but I'm not sure of the syntax. I'm not too worried about the local admin password being displayed in clear text because this script will only run for a short time, then the lines of code will be deleted.
0
 
LVL 6

Accepted Solution

by:
raptorjb007 earned 500 total points
Comment Utility
You can use a vb script to delete the current printer and add the new one. The code is below, and should be able to run with limited rights.

-Source: Microsoft Script repository
http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Also, the computer->startup scripts run when the PC boots up, before the logon prompt is displayed. As such it would be hidden from view.


====Begin code to remove a printer connection====
 

Set objNetwork = WScript.CreateObject("WScript.Network")

objNetwork.RemovePrinterConnection "\\PrintServer\xerox3006"
 
 

===end code to remove a printer connection===
 
 

===Begin Code to add a printer connection===
 

Set WshNetwork = CreateObject("WScript.Network")
 

WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300"

WshNetwork.SetDefaultPrinter "\\PrintServer1\Xerox300"
 

===End code to add a printer connection===

Open in new window

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 6

Expert Comment

by:raptorjb007
Comment Utility
Any luck?
0
 

Author Comment

by:ei00004
Comment Utility
Yes thank you, I was able to create a GPO that allows me to add Domain Users to the local admin group on their local PCs. I accomplished this by creating a new policy, then selecting Edit. Select > Computer Configuration\Windows Settings\Security Settings\Restricted Groups. Right-click Restricted Groups then click Add Group.

Click Browse > select the local computer, then select the group that you want to add to the local Administrators group (in this case, the "Domain\Domain Users" group)  click ADD, and then click OK.


This security rights change also allows me to execute a GPO Logon/Logoff batch file that copies a (.ini) file from a shared folder on the server to a folder on the client PC's C:\ drive.

It also allows the kixtart script to execute properly as administrator and changes the printers on the client pc's from one print server to another.

I know this is not the best secure way because all users are now local admins on all PCs, however this is temporarily running just long enough for the changes to be pushed out. I then can use the GPOs > Computer Configuration > Windows Settings > Security Settings > File System option to change file/folder perms to allow the Domain Users group modify permissions.
0
 

Author Comment

by:ei00004
Comment Utility
This has been resolved, thanks for your help.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

My last post dealt with using group policy preferences to set file associations, a very handy usage for a GPP. Today I am going to share another cool GPP trick, this may be a specific scenario but I run into these situations frequently in my activit…
Synchronize a new Active Directory domain with an existing Office 365 tenant
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now