vbs script not applying when put in GPO
-
Wednesday, February 20, 2013 3:40 PMHi guys,
Hoping someone can shed a bit of light on this for me please, I have a vbs file which is literally to add 2 registry entries:-
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\General\DelegateWastebasketStyle", 4, "REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\General\DelegateWastebasketStyle", 4, "REG_DWORD"
Now when I run this locally on a machine it works great however when I add it to a GPO (create the GPO, link to test OU, edit, Computer Configuration - Windows Settings - Scripts - Logon - copy the file in to "show files" and add it then apply)
for some reason it will not apply to any machines.
Any one spot something silly that I'm doing by chance?
Thanks
John- Edited by JohnW2013 Wednesday, February 20, 2013 5:12 PM
All Replies
-
Wednesday, February 20, 2013 5:38 PM
Hello,
Please forget your script and use Group Policy Preferences!http://sdmsoftware.com/group-policy-preferences/group-policy-preferences-and-the-registry/
MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!
- Proposed As Answer by Ehtisham Iftikhar Thursday, February 21, 2013 6:27 AM
-
Wednesday, February 20, 2013 7:25 PMAm 20.02.2013 16:40, schrieb JohnW2013:> WshShell.RegWrite> "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\General\DelegateWastebasketStyle",> 4, "REG_DWORD">> Now when I run this locally on a machine it works great however when I> add it to a GPO (create the GPO, link to test OU, edit, Computer> Configuration - Windows Settings - Scripts - LogonDespite what Matthias said (not a solution anyway ;-)):a) There's no "Scripts - Logon" in Computer configuration...b) If you really used computer configuration - what do you believe HKCUpoints to? Maybe your value is now located inHKEY_USERS\.DEFAULT\Software...Don't try to access HKCU in computer configuration... Unforeseen, butexpectable, results ;-)regards, Martin
NO THEY ARE NOT EVIL, if you know what you are doing: Good or bad GPOs?
Wenn meine Antwort hilfreich war, freue ich mich über eine Bewertung! If my answer was helpful, I'm glad about a rating! -
Thursday, February 21, 2013 9:51 AM
Apologies that was a typo, I was applying it in User Configuration, I think my brain is just causing me grief playing with too many of these things this week!
-
Thursday, February 21, 2013 9:53 AM
I did try to use the GP preferences first but to be honest just could not get it to apply! Put the details in, ran through a GP Results to check it was applying but when I add the machine to the OU, do a GPupdate /force and restart nothing changed hence trying the script route.
Not tried the wizard option though, will give that a go now. Thanks
- Edited by JohnW2013 Thursday, February 21, 2013 10:03 AM
-
Thursday, February 21, 2013 10:12 AMStill didn't apply anyway using the wizard, going off GPOs fast! :)
-
Thursday, February 21, 2013 11:44 AMAm 20.02.2013 16:40, schrieb JohnW2013:> link to test OU,Who is in that test OU? Did you run "gpresult /h report.html" on aclient in question and examined report.html whether your GPO is appliedat all and your script is executed at all?
NO THEY ARE NOT EVIL, if you know what you are doing: Good or bad GPOs?
Wenn meine Antwort hilfreich war, freue ich mich über eine Bewertung! If my answer was helpful, I'm glad about a rating! -
Thursday, February 21, 2013 12:10 PM
Still didn't apply anyway using the wizard, going off GPOs fast! :)
Which Action did you chose?
(Replace, Update, Create ...)MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!
-
Thursday, February 21, 2013 12:22 PMI chose Update as I figured that was the safest option in case the key already existed but was not set correctly?
-
Thursday, February 21, 2013 12:25 PM
yep I ran a gpresult on the GPM with myself as the user and the policy does show up. In that OU I just have a couple of test machines and that is it. Am starting to think maybe it is something to do with the client, maybe OS related? Both machines are running Win 7 64bit so maybe I need to rebuild one with a different OS to see if it is something along those lines...
Will go try that on the client machine as well though and see if it is getting that far, thanks
edit: yes the policy is definitely showing up on the client machine as an applied GPO
- Edited by JohnW2013 Thursday, February 21, 2013 12:46 PM
-
Thursday, February 21, 2013 2:49 PMAm 21.02.2013 13:25, schrieb JohnW2013:> edit: yes the policy is definitely showing up on the client machine as> an applied GPOSo far, so good. If you expand the GPResult HTML report to check theScripts - Startup section, is your script listed there and does it havea value under "last executed"?
NO THEY ARE NOT EVIL, if you know what you are doing: Good or bad GPOs?
Wenn meine Antwort hilfreich war, freue ich mich über eine Bewertung! If my answer was helpful, I'm glad about a rating! -
Thursday, February 21, 2013 3:07 PM
Thanks Martin for sticking with me here am still pretty new to GPOs as I'm sure you can tell!
No the script is not listed there at all so no value I'm afraid.
-
Thursday, February 21, 2013 5:01 PM> No the script is not listed there at all so no value I'm afraid.Let me rephrase that: You created a GPResult report. This report liststhe GPO that defines the script as "applied" (btw: "applied" in the usersection, hopefully?), but the script itself is not listed at all???
NO THEY ARE NOT EVIL, if you know what you are doing: Good or bad GPOs?
Wenn meine Antwort hilfreich war, freue ich mich über eine Bewertung! If my answer was helpful, I'm glad about a rating! -
Thursday, February 21, 2013 6:39 PM
In that OU I just have a couple of test machines and that is it.
You linked the policy to that OU?
The policy contains user settings, so you need to link the policy to an OU where the user accounts are located
(if you do not use GP Loopback).MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!
-
Friday, February 22, 2013 9:17 AMThe script is listed up at the very top under Group Policies Applied however that is the only place it is listed, there is nothing under User Configuration or anywhere else in the report I'm afraid.
-
Friday, February 22, 2013 9:19 AM
Really? That could cause me problems as we need this fix applied to a couple of our call centers but on the machines rather than on the users as users can work on different contracts (and therefore different machines) and we don't want the policy following the user but instead being applied to the bank of PC's on a specific business contract.In that OU I just have a couple of test machines and that is it.
You linked the policy to that OU?
The policy contains user settings, so you need to link the policy to an OU where the user accounts are located
(if you do not use GP Loopback).
MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!
-
Friday, February 22, 2013 12:01 PM
we don't want the policy following the user but instead being applied to the bank of PC's
Therefore you need to use Loopback Replace.
Please have a look at:
http://evilgpo.blogspot.de/2012/02/loopback-demystified.htmlFor your script issue, please also enable this policy:
http://gpsearch.azurewebsites.net/#1839MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!
- Marked As Answer by JohnW2013 Friday, February 22, 2013 12:59 PM
-
Friday, February 22, 2013 12:18 PM
we don't want the policy following the user but instead being applied to the bank of PC's
Therefore you need to use Loopback Replace.
Please have a look at:
http://evilgpo.blogspot.de/2012/02/loopback-demystified.htmlFor your script issue, please also enable this policy:
http://gpsearch.azurewebsites.net/#1839
MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!
You're an absolute star, I did already have the "Always wait for network..." policy enabled but had never seen the loopback policy before. Enabled that and straight away GPO worked first reboot.
Thank you both for your efforts on this one, has been driving me a bit nuts for days so is very much appreciated!

