Link to home
Start Free TrialLog in
Avatar of jfholloway
jfhollowayFlag for United States of America

asked on

removing a file from the start menu in wondows XP and Windows 7

I am trying to remove a .bat file that is in the start menu on the PCs in my network by using a .bat file that I created and put in a GPO in the logon script option but, it appears the PCs aren't running the script because the .bat file is still in the start menu. These are the lines I have in the .bat file that I am trying to execute via the GPO. I also have attached the GPO to the OU in GPO mgmt console. I know my .bat file works because if I run it manually it works.

del "c:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\standard drives.bat"
del "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\drives.bat"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\standard drives.bat"

Can someone tell me what is wrong?
Avatar of DMTechGrooup
DMTechGrooup
Flag of United States of America image

Have you run rsop.msc to see if the policy is being applied?

Which version of MS Server are you using?
You are running this in a USER GPO. Do the users that run it have permissions to delete files from all of those areas?
And to What OU have you attached the policy? The one with ALL of your affected users?
Avatar of jfholloway

ASKER

It shows nothing in the last executed field on the XP and Windows 7 PCs I looked at. The Domain is Windows 2003.
I attached it to the OU where the user accounts are. I believe they have the proper rights because when I run my script manually it does delete the file from the start menu.
When YOU run it manually yes. Are YOU just a normal user? Not a domain admin?

Have you had User run it manually after they are logged in?
The bat files in the gpo usually run before the user logs in, so I am not sure if its a permissions issue. Try to run the bat file manually on a user who doesnt have the same permissions as you do and see if you get the same results.
No.

If you're running the script at user logon, it runs under the user's own security context. Would be pointless to run as anything else.

And I already asked to try as a different user after login to see results.
You asked the same time I did, just took me 2 minutes to write it.
I run the .bat file manually when I am logged in as the user. The users are just standard domain users with no elevated privileges
AFAIK, on Windows XP security, standard domain users can't touch (write/delete) anyting in the %ALLUSERSPROFILE% (C:\Documents and Settings\All Users\...) and so may be true with Windows 7 (C:\ProgramData\) as well.
Would the following work in place of the trying to delete the file from the "all users" directory replace it with %username%

del "C:\Documents and Settings\%username%\Start Menu\Programs\Startup\standard drives.bat"

Where is the correct place to put the .bat to run it at logon. I currectly have it at the root of the netlogon folder. Should it be there or is the sysvol folder inside of the GPO that I have the logon parameter set?
ASKER CERTIFIED SOLUTION
Avatar of discgman
discgman
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
Worked perfect. thanks