SOLVED

User Logon Scripts Headache

%3CLINGO-SUB%20id%3D%22lingo-sub-1033746%22%20slang%3D%22en-US%22%3EUser%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1033746%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20hardening%20a%20workstation%20in%20a%20workgroup%20environment%2C%20which%20means%20I%20have%20to%20rely%20on%20MDT%2C%20LGPO.exe%20and%20PowerShell%20scripts%20to%20achieve%20my%20goals%20-%20in%20an%20automated%20way%20of%20course.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESadly%20LGPO.exe%20does%20not%20support%20scripts%2C%20neither%20Group%20Policy%20Preferences.%20I%20have%20to%20use%20logon%20scripts%2C%20which%20wasn't%20hard%20on%20old%20OSes%20-%20just%20drop%20them%20to%20the%20appropriate%20%22C%3A%5CWindows%5CSystem32%5CGroupPolicy%5CScripts%22%20subfolders%20on%20the%20target%20computer.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20Windows%2010%20this%20is%20a%20different%20story%20-%20you%20also%20need%20to%20add%20a%20ini%20file%20to%20those%20folders%2C%20as%20well%20as%20create%20registry%20keys%20-%20for%20machine%20scripts%2C%20stuff%20under%20%22HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CScripts%22%20and%20%22%3CSPAN%3EHKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CState%5CScripts%22.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhile%20it%20works%20for%20machine%20scripts%2C%20it%20fails%20for%20user%20scripts%20-%20I%20have%20tried%20with%20%22%3CSPAN%3EHKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CScripts%22%20and%20%22HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CState%5C%5BSID%5D%22%20registry%20hives%20without%20success%20-%20error%20is%20%22incorrect%20function%22%20(the%20same%20I%20had%20for%20computer%20scripts%20until%20I%20configured%20all%20required%20registry%20keys).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EProcMon%20detects%20some%20more%20updated%20key%20when%20manually%20adding%20login%20scripts%20using%20gpedit.msc%2C%20however%20those%20seems%20created%20automatically%20by%20those%20above.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EDid%20anyone%20manage%20to%20successfully%20add%20user%20logon%2Flogoff%20scripts%20to%20a%20workstation%20preconfigured%20with%20LGPO%20%3F%20Could%20it%20be%20some%20kind%20of%20permissions%20issue%20instead%20%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1059186%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1059186%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F431722%22%20target%3D%22_blank%22%3E%40Alban1999%3C%2FA%3E%20-%20I%20just%20spent%20a%20little%20time%20looking%20into%20this%20-%20nobody's%20ever%20asked%20about%20startup%2Flogon%20scripts%20for%20local%20policy%20before.%20First%3A%20I%20didn't%20see%20any%20registry%20writes%20when%20I%20configured%20scripts.%20Second%3A%20my%20quick%20attempt%20to%20configure%20a%20PowerShell%20script%20didn't%20do%20what%20I%20expected%2C%20but%20a%20*.cmd%20batch%20file%20did.%20It%20might%20be%20(have%20to%20dig%20deeper%20to%20verify)%20that%20this%20old%20part%20of%20policy%20hasn't%20been%20updated%20to%20handle%20PowerShell.%20Might%20need%20to%20explicitly%20invoke%20powershell.exe%20from%20a%20batch%20file%20or%20something.%3C%2FP%3E%0A%3CP%3ESorry%2C%20but%20I%20can't%20spend%20any%20more%20time%20on%20it%20right%20now.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1071510%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1071510%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F171536%22%20target%3D%22_blank%22%3E%40Aaron%20Margosis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%2C%20I%20have%20been%20able%20to%20solve%20this%20issue.%20I%20was%20missing%20CSE%20GUID%20information%20from%20the%20GPT.ini%20file%2C%20more%20precisely%20CSE%20GUID%20related%20to%20scripts%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3EgPCUserExtensionNames%3D%5B%7B42B5FAAE-6536-11D2-AE5A-0000F87571E3%7D%7B40B6664F-4972-11D1-A7CA-0000F87571E3%7D%5D%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20copying%20a%20gpt.ini%20file%20filled%20with%20those%20entries%20into%20my%20target%20computer%2C%20along%20with%20creating%20appropriate%20registry%20keys%2C%20my%20user%20logon%2Flogoff%20Powershell%20scripts%20are%20now%20executed%20without%20issues.%3C%2FP%3E%3CP%3EI%20didn't%20have%20to%20do%20that%20for%20machine%20startup%2Fshutdown%20PowerShell%20scripts%20tho%2C%20no%20idea%20why%20so%20far.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20I%20can%20confirm%20with%20Procmon%20new%20registry%20hives%2Fkeys%20are%20indeed%20created%20when%20configuring%20scripts%2C%20I'm%20not%20sure%20why%20you%20do%20not%20see%20this.%20My%20target%20is%20a%20LTSC%202016%20operating%20system%20just%20in%20case.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20are%20not%20able%20to%20provide%20support%20for%20scripts%20with%20LGPO.exe%20right%20now%2C%20at%20least%20please%20try%20to%20document%20this%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-%20For%20machine%20scripts%2C%20copy%20shutdown%20and%2For%20startup%20folders%20to%20target%2C%20as%20well%20as%20a%20prefilled%20pssscripts.ini%20to%26nbsp%3B%3CFONT%3EC%3A%5CWindows%5CSystem32%5CGroupPolicy%5CMachine%5CScripts%3C%2FFONT%3E.%20Then%20create%20appropriate%20registry%20keys%20under%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E%22HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CScripts%22%20and%20%22%3C%2FSPAN%3E%3CSPAN%3EHKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CState%5CScripts%22.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-%20For%20user%20scripts%2C%26nbsp%3B%3CSPAN%3Ecopy%20logon%20and%2For%20logoff%20folders%20to%20target%2C%20as%20well%20as%20a%20prefilled%20pssscripts.ini%20to%26nbsp%3B%3C%2FSPAN%3E%3CFONT%3EC%3A%5CWindows%5CSystem32%5CGroupPolicy%5CUser%5CScripts%20and%20prefilled%20GPT.ini%20file%20to%20%3CFONT%3EC%3A%5CWindows%5CSystem32%5CGroupPolicy%3C%2FFONT%3E.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThen%20create%20appropriate%20registry%20keys%20under%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3EHKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CScripts%22%20and%20%22HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CGroup%20Policy%5CState%5C%5BSID%5D%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E(HKLM%20hive%20for%20the%20second%20registry%20hive%20is%20not%20an%20error).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1097899%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1097899%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F431722%22%20target%3D%22_blank%22%3E%40Alban1999%3C%2FA%3E%26nbsp%3B-%20news%20you%20might%20find%20welcome%20is%20that%20the%20next%20set%20of%20Policy%20Analyzer%20and%20LGPO%20tools%20will%20include%20support%20for%20client%20side%20extensions.%20%22LGPO%20%2Fg%26nbsp%3B%3CEM%3Epath%22%26nbsp%3B%3C%2FEM%3Ewill%20identify%20the%20machine%20and%20user%20CSEs%20referenced%20in%20the%20backup.xml%20files%20and%20register%20them.%20Policy%20Analyzer%20will%20also%20capture%20CSEs%20into%20the%20.PolicyRules%20files.%20(And%20LGPO%20%2Fp%26nbsp%3B%3CEM%3Efile.PolicyRules%3C%2FEM%3E%20will%20let%20you%20use%20Policy%20Analyzer%20files%20-%20with%20CSE%20references%20-%20to%20configure%20local%20policy.)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENo%20movement%20on%20startup%2Flogon%20scripts%2C%20though.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1109704%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1109704%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F171536%22%20target%3D%22_blank%22%3E%40Aaron%20Margosis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%2C%20that's%20good%20news%20-%20so%20basically%2C%20I%20won't%20have%20to%20mess%20with%20GPT.ini%20file%20in%20the%20future%2C%20even%20for%20user%20scripts%20%3F%20Your%20last%20line%20is%20a%20bit%20confusing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20what%20I%20understand%2C%20I%20still%20need%20to%20manage%20the%20%22copy%20script%20to%20target%22%20%2B%20%22create%20appropriate%20registry%20keys%22%20steps%2C%20however%20I%20won't%20need%20to%20update%20gpt.ini%20file%20anymore%2C%20as%20scripts%20CSE%20will%20be%20already%20included%20within.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20I'm%20not%20mistaken.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1110038%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1110038%22%20slang%3D%22en-US%22%3E%3CP%3EThat's%20correct%3A%3C%2FP%3E%0A%3CP%3E*%20%22LGPO.exe%20%2Fb%22%20will%20parse%20gpt.ini%20for%20you%20and%20pick%20up%20the%20Scripts%20machine%20CSE.%3C%2FP%3E%0A%3CP%3E*%20When%20Policy%20Analyzer%20imports%20a%20GPO%20backup%2C%20it%20will%20pick%20up%20the%20CSEs%20referenced%20in%20the%20backup.xml%20file(s)%20and%20incorporate%20them%20into%20the%20resulting%20.PolicyRules%20file.%3C%2FP%3E%0A%3CP%3E*%20%22LGPO.exe%20%2Fg%20%3CEM%3Epath%3C%2FEM%3E%22%20will%20inspect%20backup.xml%20file(s)%20and%20register%20machine%20and%20user%20CSEs%20that%20it%20finds.%3C%2FP%3E%0A%3CP%3E*%20%22LGPO.exe%20%2Fp%20%3CEM%3Epath%5Clgpo.PolicyRules%3C%2FEM%3E%22%20will%20apply%20all%20policy%20settings%20in%20the%20PolicyRules%20file%2C%20including%20registering%20machine%2Fuser%20CSEs.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1131185%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1131185%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F171536%22%20target%3D%22_blank%22%3E%40Aaron%20Margosis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%20news%20Aaron%20!%20Could%20you%20tell%20me%20when%20this%20updated%20LGPO.exe%20will%20be%20available%20%3F%20I'm%20eager%20to%20test%20it%20with%20this%20improved%20feature.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20I%20promise%20I%20won't%20use%20scripts%20anymore%20the%20day%20LGPO.exe%20supports%20Group%20Policy%20Preference%20-%20one%20of%20the%20top%20users%20requests%20I'm%20sure.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%20and%20thanks%20again%20for%20all%20the%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1260961%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1260961%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F431722%22%20target%3D%22_blank%22%3E%40Alban1999%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20strongly%20feel%20you%2C%20as%20I%20spent%20a%20lot%20of%20time%20trying%20to%20automate%20the%20installation%20of%20a%20startup%20script%20on%20Windows%2010%20and%20Windows%207%20using%20the%20Machine%20folder%2C%20and%20it%20was%20a%20disappointing%20experience%2C%20and%20since%2C%20as%20you%20mentioned%2C%20LGPO.exe%20does%20not%20handle%20startup%20script%20at%20the%20moment%2C%20I%20had%20to%20use%20a%20.reg%20file%20and%20manually%20edit%20the%20GPT.ini%20file%20to%20point%20to%20the%20correct%20script.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20it%20was%20getting%20way%20overkill%20for%20the%20initial%20task%20(regulate%20fans%20speed%20at%20startup%2C%20depending%20on%20some%20hardware%20presence%20or%20not)%2C%20I%20ended%20up%20creating%20a%20Scheduled%20Task%20launching%20the%20PowerShell%20script%20at%20startup.%20It%20works%20great%2C%20and%20it%20literally%20takes%202%20lines%20of%20PowerShell%20and%20a%20XML%20Task%20file%20to%20import%20it%20on%20a%20new%20machine.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F171536%22%20target%3D%22_blank%22%3E%40Aaron%20Margosis%3C%2FA%3E%26nbsp%3BThat's%20great%20news%20that%20a%20new%20version%20of%20LGPO%20is%20on%20the%20way%20%3A)%3C%2Fimg%3E%20If%20you%20need%20testers%20for%20it%2C%20do%20not%20hesitate%20to%20let%20me%20know%2C%20would%20be%20happy%20to%20provide%20a%20feedback%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1562785%22%20slang%3D%22en-US%22%3ERe%3A%20User%20Logon%20Scripts%20Headache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1562785%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F598981%22%20target%3D%22_blank%22%3E%40Harvester%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20reply%2C%20indeed%20a%20script%20and%20a%20scheduled%20task%20is%20a%20way%20to%20do%20this%20-%20however%20I'm%20working%20on%20a%20hardened%20(DoD%20level)%20workstation%2C%20so%20I%20was%20not%20able%20to%20do%20that.%20Cheers%20!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello,

 

I'm hardening a workstation in a workgroup environment, which means I have to rely on MDT, LGPO.exe and PowerShell scripts to achieve my goals - in an automated way of course.

 

Sadly LGPO.exe does not support scripts, neither Group Policy Preferences. I have to use logon scripts, which wasn't hard on old OSes - just drop them to the appropriate "C:\Windows\System32\GroupPolicy\Scripts" subfolders on the target computer.

 

In Windows 10 this is a different story - you also need to add a ini file to those folders, as well as create registry keys - for machine scripts, stuff under "HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\Scripts" and "HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\Scripts".

 

While it works for machine scripts, it fails for user scripts - I have tried with "HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy\Scripts" and "HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\[SID]" registry hives without success - error is "incorrect function" (the same I had for computer scripts until I configured all required registry keys).

ProcMon detects some more updated key when manually adding login scripts using gpedit.msc, however those seems created automatically by those above.

 

Did anyone manage to successfully add user logon/logoff scripts to a workstation preconfigured with LGPO ? Could it be some kind of permissions issue instead ?

 

Thanks

8 Replies

@Alban1999 - I just spent a little time looking into this - nobody's ever asked about startup/logon scripts for local policy before. First: I didn't see any registry writes when I configured scripts. Second: my quick attempt to configure a PowerShell script didn't do what I expected, but a *.cmd batch file did. It might be (have to dig deeper to verify) that this old part of policy hasn't been updated to handle PowerShell. Might need to explicitly invoke powershell.exe from a batch file or something.

Sorry, but I can't spend any more time on it right now.

best response confirmed by Alban1999 (Occasional Contributor)
Solution

@Aaron Margosis 

 

Hello, I have been able to solve this issue. I was missing CSE GUID information from the GPT.ini file, more precisely CSE GUID related to scripts :

 

gPCUserExtensionNames=[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}]

 

By copying a gpt.ini file filled with those entries into my target computer, along with creating appropriate registry keys, my user logon/logoff Powershell scripts are now executed without issues.

I didn't have to do that for machine startup/shutdown PowerShell scripts tho, no idea why so far.

 

Also, I can confirm with Procmon new registry hives/keys are indeed created when configuring scripts, I'm not sure why you do not see this. My target is a LTSC 2016 operating system just in case.

 

If you are not able to provide support for scripts with LGPO.exe right now, at least please try to document this :

 

- For machine scripts, copy shutdown and/or startup folders to target, as well as a prefilled pssscripts.ini to C:\Windows\System32\GroupPolicy\Machine\Scripts. Then create appropriate registry keys under:

"HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\Scripts" and "HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\Scripts".

 

- For user scripts, copy logon and/or logoff folders to target, as well as a prefilled pssscripts.ini to C:\Windows\System32\GroupPolicy\User\Scripts and prefilled GPT.ini file to C:\Windows\System32\GroupPolicy.

Then create appropriate registry keys under:

"HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy\Scripts" and "HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\[SID]"

(HKLM hive for the second registry hive is not an error).

 

Regards,

@Alban1999 - news you might find welcome is that the next set of Policy Analyzer and LGPO tools will include support for client side extensions. "LGPO /g path" will identify the machine and user CSEs referenced in the backup.xml files and register them. Policy Analyzer will also capture CSEs into the .PolicyRules files. (And LGPO /p file.PolicyRules will let you use Policy Analyzer files - with CSE references - to configure local policy.)

 

No movement on startup/logon scripts, though.

@Aaron Margosis 

 

Hello, that's good news - so basically, I won't have to mess with GPT.ini file in the future, even for user scripts ? Your last line is a bit confusing.

 

From what I understand, I still need to manage the "copy script to target" + "create appropriate registry keys" steps, however I won't need to update gpt.ini file anymore, as scripts CSE will be already included within.

 

Please let me know if I'm not mistaken.

That's correct:

* "LGPO.exe /b" will parse gpt.ini for you and pick up the Scripts machine CSE.

* When Policy Analyzer imports a GPO backup, it will pick up the CSEs referenced in the backup.xml file(s) and incorporate them into the resulting .PolicyRules file.

* "LGPO.exe /g path" will inspect backup.xml file(s) and register machine and user CSEs that it finds.

* "LGPO.exe /p path\lgpo.PolicyRules" will apply all policy settings in the PolicyRules file, including registering machine/user CSEs.

@Aaron Margosis 

 

Great news Aaron ! Could you tell me when this updated LGPO.exe will be available ? I'm eager to test it with this improved feature.

 

Also, I promise I won't use scripts anymore the day LGPO.exe supports Group Policy Preference - one of the top users requests I'm sure.

 

Regards and thanks again for all the help

@Alban1999 

 

I strongly feel you, as I spent a lot of time trying to automate the installation of a startup script on Windows 10 and Windows 7 using the Machine folder, and it was a disappointing experience, and since, as you mentioned, LGPO.exe does not handle startup script at the moment, I had to use a .reg file and manually edit the GPT.ini file to point to the correct script.

 

As it was getting way overkill for the initial task (regulate fans speed at startup, depending on some hardware presence or not), I ended up creating a Scheduled Task launching the PowerShell script at startup. It works great, and it literally takes 2 lines of PowerShell and a XML Task file to import it on a new machine.

 

@Aaron Margosis That's great news that a new version of LGPO is on the way :) If you need testers for it, do not hesitate to let me know, would be happy to provide a feedback :)

@Harvester Thanks for your reply, indeed a script and a scheduled task is a way to do this - however I'm working on a hardened (DoD level) workstation, so I was not able to do that. Cheers !

www.000webhost.com