Link to home
Start Free TrialLog in
Avatar of bankadmin
bankadminFlag for United States of America

asked on

Need help setting up a scheduled task via GPO

2008 R2 DC windows 7 64 PC's
Im attempting to setup a GPO that will run a script that I wrote very basic "net user administrator /active:no" the script works when I run it locally on a PC but I cant seem to get the script to run via GPO. I have tried both computer and user\preferences\control panel settings\scheduled task.
I have the scheduled task configured like this:
Action : create
Run: I have the script saved on the local c:drive of the DC and the path reflects, I have also tried to put the actual command there and the arguments below that didnt work either
Start in c:\
I also have it set to run at logon although the time still shows when I select logon for the schedule.

When I run gpresult on the test PC Im using it shows the GPO that has the schdule task configured has been applied
Avatar of it_saige
it_saige
Flag of United States of America image

Quick question, any reason why this is being configured as a scheduled task instead of a computer startup script?User generated image-saige-
Avatar of bankadmin

ASKER

No specific reason Im open to anyway to get this done. Ill give it a try

I also tried to run the scheduled task with domain admin creds, still didnt work
I was only suggesting this because it really only needs to run once when the computer starts up and using a scheduled task for this is basically overkill.

I would, however, either beef up the script or create a new GPO to ensure that the script only runs on client computers and not servers.

-saige-
I have my Servers seperated in AD (OU's) so if I do get this to work it wont apply to my servers.  I setup a logon script and it didnt work I rebooted the PC I did a gpupdate /force and it shows the GPO did apply via gpupdate. I setup the logon script to run under computer and user...
What are the contents of the startup script?

-saige-
Its  a .cmd file I created with notepad and this is whats in it
net user administrator /acitve:no
It does work when I save it to a work station and run it manually
For testing, I create a GPO and WMI Filter for one specific machine.  I linked the WMI Filter to this one specific machine and created a script called DisableAdministrator.cmd with only the command:
net user Administrator /active:no

Open in new window


I logged into the computer defined by the WMI Filter and verified that the Administrator acount was set to an active status:User generated image
And run an RSoP (Resultant Set of Policy); in Logging Mode; to ensure that the policy has been applied the the system (the startup script should only run when the computer starts up):User generated image
I rebooted the system and viola:User generated imageUser generated image-saige-
You can also use the event logs to determine if the script has been ran on the system:User generated imageUser generated image-saige-
I checked the system logs and I only had one entry per boot for group policy and it states "The Group Policy settings for the user were processed successfully. New settings from 3 GPO's were detected and applied".
I also ran the GSOP on the PC Im testing with and it shows the startup script  just like your screen shot does.
I have this PC in its own OU and the only GPO I have directly linked to the OU is this test one that I have the startup script configured in, however its getting a couple of GPO's that are applied to everything in our domain.

Its still not working.
Just verifying that this is a Computer startup script and not a User login script?  Also can you post an RSoP screen shot?

-saige-
Also what is the OS of the client computer?  What are your Forest/Domain Functional Levels and the OS of your DC?

-saige-
Server 2008 R2 DC, PC is a windows 7 32 bit.. Not sure what you mean of forest/domain functional levels. Our AD is just the domain on top and the OU's underneath with PC's, users, groups, ext..
GSOP-SS.docx
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have to drop this right now and Im out tomorrow, I will pick it up Monday and let you know how it goes.

Thanks
Its working I had the path defined to a location that was different than the location it was expecting to see it in.

Thanks for all the help