Windows 10 – Batch – Add Pinned Items into Default User Profile

email me

This is how you add pinned items into the default user profile.

Save this as script.cmd and run.

DEL /F /S /Q /A “C:\Users\Default\Roaming\AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*”

:: Reference Machine Shortcts
COPY /y “C:\TaskBarItems” “C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar”

REG LOAD HKU\TempLoad “C:\Users\default\NTUSER.DAT”

REG DELETE “HKU\TempLoad\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband” /F

:: Reference Machine Reg Keys
REG IMPORT C:\TaskBarItems.reg

REG UNLOAD HKU\TaskBarItems

 

Notes

Using GP and a modified layout is a great way to manage the pinned items—for all types of user logins: New (default), current, and old profiles. Take a look here: https://docs.microsoft.com/en-us/windows/configuration/configure-windows-10-taskbar

Or here: http://eddiejackson.net/wp/?p=15446

Windows 10 – Example Pinned Shortcuts Registry Keys

email me

This is pinned icons for File Explorer, Chrome, and Internet Explorer. You can use a self-extracting RAR file upon user login to extract the shortcuts to the TaskBar area, and then apply the appropriate reg keys using a script—-which can be called from a runonce reg key.

Note, this method will allow users to change the TaskBar. If you’re looking to lock it down, try this: https://docs.microsoft.com/en-us/windows/configuration/configure-windows-10-taskbar

Caveat of the XML file, if you happen to use redirected profiles (as in UNC paths to store user profiles)…and you also lock down navigation of the C: drive, expect problems. This is something Microsoft has not tested well. I ended up using GP with the XML file, and adding shortcuts to an acceptable, working local path (see Notes for my XML file).

 

Snapshot

 

Shortcuts Go Here

“%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\”

 

Reg Keys

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
“FavoritesResolve”=hex:29,03,00,00,4c,00,00,00,01,14,02,00,00,00,00,00,c0,00,\
00,00,00,00,00,46,83,00,80,00,20,00,00,00,c1,d2,70,6b,ee,37,d3,01,c1,d2,70,\
6b,ee,37,d3,01,cd,3f,db,61,2a,a0,d2,01,97,01,00,00,00,00,00,00,01,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,8e,01,3a,00,1f,80,c8,27,34,1f,10,5c,10,\
42,aa,03,2e,e4,52,87,d6,68,26,00,01,00,26,00,ef,be,12,00,00,00,49,3b,2b,f7,\
d5,37,d3,01,5a,13,b8,7a,eb,37,d3,01,5a,13,b8,7a,eb,37,d3,01,14,00,56,00,31,\
00,00,00,00,00,3c,4b,84,01,11,00,54,61,73,6b,42,61,72,00,40,00,09,00,04,00,\
ef,be,3b,4b,22,aa,3c,4b,84,01,2e,00,00,00,a3,90,03,00,00,00,02,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,f3,06,b2,00,54,00,61,00,73,00,6b,00,42,00,\
61,00,72,00,00,00,16,00,fc,00,32,00,97,01,00,00,72,4a,4c,a7,20,00,46,49,4c,\
45,45,58,7e,31,2e,4c,4e,4b,00,00,7c,00,09,00,04,00,ef,be,3c,4b,84,01,3c,4b,\
84,01,2e,00,00,00,86,e5,00,00,00,00,17,00,00,00,00,00,00,00,00,00,52,00,00,\
00,00,00,33,98,1e,00,46,00,69,00,6c,00,65,00,20,00,45,00,78,00,70,00,6c,00,\
6f,00,72,00,65,00,72,00,2e,00,6c,00,6e,00,6b,00,00,00,40,00,73,00,68,00,65,\
00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,32,00,32,00,\
30,00,36,00,37,00,00,00,1c,00,22,00,00,00,1e,00,ef,be,02,00,55,00,73,00,65,\
00,72,00,50,00,69,00,6e,00,6e,00,65,00,64,00,00,00,1c,00,42,00,00,00,1d,00,\
ef,be,02,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,57,\
00,69,00,6e,00,64,00,6f,00,77,00,73,00,2e,00,45,00,78,00,70,00,6c,00,6f,00,\
72,00,65,00,72,00,00,00,1c,00,00,00,a4,00,00,00,1c,00,00,00,01,00,00,00,1c,\
00,00,00,2d,00,00,00,00,00,00,00,a3,00,00,00,11,00,00,00,03,00,00,00,c1,f5,\
51,4a,10,00,00,00,00,43,3a,5c,55,73,65,72,73,5c,41,64,6d,69,6e,69,73,74,72,\
61,74,6f,72,5c,41,70,70,44,61,74,61,5c,52,6f,61,6d,69,6e,67,5c,4d,69,63,72,\
6f,73,6f,66,74,5c,49,6e,74,65,72,6e,65,74,20,45,78,70,6c,6f,72,65,72,5c,51,\
75,69,63,6b,20,4c,61,75,6e,63,68,5c,55,73,65,72,20,50,69,6e,6e,65,64,5c,54,\
61,73,6b,42,61,72,5c,46,69,6c,65,20,45,78,70,6c,6f,72,65,72,2e,6c,6e,6b,00,\
00,60,00,00,00,03,00,00,a0,58,00,00,00,00,00,00,00,31,32,36,35,30,2d,32,32,\
37,34,62,00,00,00,00,00,ea,a7,73,21,9c,28,15,4b,9c,ee,cd,3a,4b,23,ce,9c,c0,\
f2,04,02,e1,a3,e7,11,ac,29,00,23,7d,48,91,8c,ea,a7,73,21,9c,28,15,4b,9c,ee,\
cd,3a,4b,23,ce,9c,c0,f2,04,02,e1,a3,e7,11,ac,29,00,23,7d,48,91,8c,45,00,00,\
00,09,00,00,a0,39,00,00,00,31,53,50,53,b1,16,6d,44,ad,8d,70,48,a7,48,40,2e,\
a4,3d,78,8c,1d,00,00,00,68,00,00,00,00,48,00,00,00,1b,9f,1f,00,bd,a3,e7,11,\
86,a5,80,6e,6f,6e,69,63,00,00,00,00,00,00,00,00,00,00,00,00,38,02,00,00,4c,\
00,00,00,01,14,02,00,00,00,00,00,c0,00,00,00,00,00,00,46,83,00,80,00,20,00,\
00,00,bb,e4,43,89,6e,64,d1,01,bb,e4,43,89,6e,64,d1,01,40,ff,5c,88,6e,64,d1,\
01,ee,08,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
ee,00,14,00,1f,80,c8,27,34,1f,10,5c,10,42,aa,03,2e,e4,52,87,d6,68,52,00,31,\
00,00,00,00,00,4b,48,45,0e,11,00,54,61,73,6b,42,61,72,00,3c,00,08,00,04,00,\
ef,be,45,48,b4,29,4b,48,45,0e,2a,00,00,00,0c,e7,00,00,00,00,01,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,54,00,61,00,73,00,6b,00,42,00,61,00,72,00,\
00,00,16,00,86,00,32,00,ee,08,00,00,4b,48,44,0e,20,00,47,4f,4f,47,4c,45,7e,\
31,2e,4c,4e,4b,00,00,50,00,08,00,04,00,ef,be,4b,48,45,0e,4b,48,45,0e,2a,00,\
00,00,08,30,03,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,47,\
00,6f,00,6f,00,67,00,6c,00,65,00,20,00,43,00,68,00,72,00,6f,00,6d,00,65,00,\
2e,00,6c,00,6e,00,6b,00,00,00,1c,00,1a,00,00,00,1d,00,ef,be,02,00,43,00,68,\
00,72,00,6f,00,6d,00,65,00,00,00,1c,00,00,00,98,00,00,00,1c,00,00,00,01,00,\
00,00,1c,00,00,00,2d,00,00,00,00,00,00,00,97,00,00,00,11,00,00,00,03,00,00,\
00,c1,f5,51,4a,10,00,00,00,00,43,3a,5c,55,73,65,72,73,5c,6b,5c,41,70,70,44,\
61,74,61,5c,52,6f,61,6d,69,6e,67,5c,4d,69,63,72,6f,73,6f,66,74,5c,49,6e,74,\
65,72,6e,65,74,20,45,78,70,6c,6f,72,65,72,5c,51,75,69,63,6b,20,4c,61,75,6e,\
63,68,5c,55,73,65,72,20,50,69,6e,6e,65,64,5c,54,61,73,6b,42,61,72,5c,47,6f,\
6f,67,6c,65,20,43,68,72,6f,6d,65,2e,6c,6e,6b,00,00,60,00,00,00,03,00,00,a0,\
58,00,00,00,00,00,00,00,6b,2d,70,63,00,00,00,00,00,00,00,00,00,00,00,00,ea,\
a7,73,21,9c,28,15,4b,9c,ee,cd,3a,4b,23,ce,9c,1f,94,27,14,60,d0,e5,11,bb,69,\
00,1c,23,4a,3a,e3,ea,a7,73,21,9c,28,15,4b,9c,ee,cd,3a,4b,23,ce,9c,1f,94,27,\
14,60,d0,e5,11,bb,69,00,1c,23,4a,3a,e3,00,00,00,00,6b,03,00,00,4c,00,00,00,\
01,14,02,00,00,00,00,00,c0,00,00,00,00,00,00,46,83,00,80,00,20,00,00,00,e9,\
6f,b8,6b,05,38,d3,01,e9,6f,b8,6b,05,38,d3,01,0a,4f,f0,4f,ee,37,d3,01,23,05,\
00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,cc,01,3a,\
00,1f,80,c8,27,34,1f,10,5c,10,42,aa,03,2e,e4,52,87,d6,68,26,00,01,00,26,00,\
ef,be,12,00,00,00,49,3b,2b,f7,d5,37,d3,01,5a,13,b8,7a,eb,37,d3,01,5a,13,b8,\
7a,eb,37,d3,01,14,00,56,00,31,00,00,00,00,00,3c,4b,18,17,11,00,54,61,73,6b,\
42,61,72,00,40,00,09,00,04,00,ef,be,3b,4b,22,aa,3c,4b,17,17,2e,00,00,00,a3,\
90,03,00,00,00,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2a,08,bb,00,\
54,00,61,00,73,00,6b,00,42,00,61,00,72,00,00,00,16,00,3a,01,32,00,23,05,00,\
00,3c,4b,6b,01,20,00,49,4e,54,45,52,4e,7e,31,2e,4c,4e,4b,00,00,aa,00,09,00,\
04,00,ef,be,3c,4b,17,17,3c,4b,17,17,2e,00,00,00,42,71,01,00,00,00,07,00,00,\
00,00,00,00,00,00,00,5a,00,00,00,00,00,f6,e1,c9,00,49,00,6e,00,74,00,65,00,\
72,00,6e,00,65,00,74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,\
00,2e,00,6c,00,6e,00,6b,00,00,00,40,00,43,00,3a,00,5c,00,57,00,49,00,4e,00,\
44,00,4f,00,57,00,53,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,\
00,5c,00,69,00,65,00,34,00,75,00,69,00,6e,00,69,00,74,00,2e,00,65,00,78,00,\
65,00,2c,00,2d,00,37,00,33,00,31,00,00,00,1c,00,22,00,00,00,1e,00,ef,be,02,\
00,55,00,73,00,65,00,72,00,50,00,69,00,6e,00,6e,00,65,00,64,00,00,00,1c,00,\
52,00,00,00,1d,00,ef,be,02,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,\
00,74,00,2e,00,49,00,6e,00,74,00,65,00,72,00,6e,00,65,00,74,00,45,00,78,00,\
70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,44,00,65,00,66,00,61,00,75,00,6c,\
00,74,00,00,00,1c,00,00,00,a8,00,00,00,1c,00,00,00,01,00,00,00,1c,00,00,00,\
2d,00,00,00,00,00,00,00,a7,00,00,00,11,00,00,00,03,00,00,00,c1,f5,51,4a,10,\
00,00,00,00,43,3a,5c,55,73,65,72,73,5c,41,64,6d,69,6e,69,73,74,72,61,74,6f,\
72,5c,41,70,70,44,61,74,61,5c,52,6f,61,6d,69,6e,67,5c,4d,69,63,72,6f,73,6f,\
66,74,5c,49,6e,74,65,72,6e,65,74,20,45,78,70,6c,6f,72,65,72,5c,51,75,69,63,\
6b,20,4c,61,75,6e,63,68,5c,55,73,65,72,20,50,69,6e,6e,65,64,5c,54,61,73,6b,\
42,61,72,5c,49,6e,74,65,72,6e,65,74,20,45,78,70,6c,6f,72,65,72,2e,6c,6e,6b,\
00,00,60,00,00,00,03,00,00,a0,58,00,00,00,00,00,00,00,31,32,36,35,30,2d,32,\
32,37,34,62,00,00,00,00,00,ea,a7,73,21,9c,28,15,4b,9c,ee,cd,3a,4b,23,ce,9c,\
8f,37,15,cf,ed,a3,e7,11,ac,2a,00,23,7d,48,91,8c,ea,a7,73,21,9c,28,15,4b,9c,\
ee,cd,3a,4b,23,ce,9c,8f,37,15,cf,ed,a3,e7,11,ac,2a,00,23,7d,48,91,8c,45,00,\
00,00,09,00,00,a0,39,00,00,00,31,53,50,53,b1,16,6d,44,ad,8d,70,48,a7,48,40,\
2e,a4,3d,78,8c,1d,00,00,00,68,00,00,00,00,48,00,00,00,1b,9f,1f,00,bd,a3,e7,\
11,86,a5,80,6e,6f,6e,69,63,00,00,00,00,00,00,00,00,00,00,00,00

“Favorites”=hex:00,92,01,00,00,3a,00,1f,80,c8,27,34,1f,10,5c,10,42,aa,03,2e,e4,\
52,87,d6,68,26,00,01,00,26,00,ef,be,12,00,00,00,49,3b,2b,f7,d5,37,d3,01,5a,\
13,b8,7a,eb,37,d3,01,5a,13,b8,7a,eb,37,d3,01,14,00,56,00,31,00,00,00,00,00,\
3c,4b,84,01,11,00,54,61,73,6b,42,61,72,00,40,00,09,00,04,00,ef,be,3b,4b,22,\
aa,3c,4b,84,01,2e,00,00,00,a3,90,03,00,00,00,02,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,f3,06,b2,00,54,00,61,00,73,00,6b,00,42,00,61,00,72,00,00,\
00,16,00,00,01,32,00,97,01,00,00,72,4a,4c,a7,20,00,46,49,4c,45,45,58,7e,31,\
2e,4c,4e,4b,00,00,7c,00,09,00,04,00,ef,be,3c,4b,84,01,3c,4b,84,01,2e,00,00,\
00,86,e5,00,00,00,00,17,00,00,00,00,00,00,00,00,00,52,00,00,00,00,00,33,98,\
1e,00,46,00,69,00,6c,00,65,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,\
00,72,00,2e,00,6c,00,6e,00,6b,00,00,00,40,00,73,00,68,00,65,00,6c,00,6c,00,\
33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,32,00,32,00,30,00,36,00,37,\
00,00,00,1c,00,42,00,00,00,1d,00,ef,be,02,00,4d,00,69,00,63,00,72,00,6f,00,\
73,00,6f,00,66,00,74,00,2e,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,2e,\
00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,00,00,1c,00,26,00,00,00,\
1e,00,ef,be,02,00,53,00,79,00,73,00,74,00,65,00,6d,00,50,00,69,00,6e,00,6e,\
00,65,00,64,00,00,00,1c,00,00,00,00,10,01,00,00,14,00,1f,80,c8,27,34,1f,10,\
5c,10,42,aa,03,2e,e4,52,87,d6,68,52,00,31,00,00,00,00,00,4b,48,45,0e,11,00,\
54,61,73,6b,42,61,72,00,3c,00,08,00,04,00,ef,be,45,48,b4,29,4b,48,45,0e,2a,\
00,00,00,0c,e7,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
54,00,61,00,73,00,6b,00,42,00,61,00,72,00,00,00,16,00,a8,00,32,00,ee,08,00,\
00,4b,48,44,0e,20,00,47,4f,4f,47,4c,45,7e,31,2e,4c,4e,4b,00,00,50,00,08,00,\
04,00,ef,be,4b,48,45,0e,4b,48,45,0e,2a,00,00,00,08,30,03,00,00,00,01,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,47,00,6f,00,6f,00,67,00,6c,00,65,00,\
20,00,43,00,68,00,72,00,6f,00,6d,00,65,00,2e,00,6c,00,6e,00,6b,00,00,00,1c,\
00,22,00,00,00,1e,00,ef,be,02,00,55,00,73,00,65,00,72,00,50,00,69,00,6e,00,\
6e,00,65,00,64,00,00,00,1c,00,1a,00,00,00,1d,00,ef,be,02,00,43,00,68,00,72,\
00,6f,00,6d,00,65,00,00,00,1c,00,00,00,00,cc,01,00,00,3a,00,1f,80,c8,27,34,\
1f,10,5c,10,42,aa,03,2e,e4,52,87,d6,68,26,00,01,00,26,00,ef,be,12,00,00,00,\
49,3b,2b,f7,d5,37,d3,01,5a,13,b8,7a,eb,37,d3,01,5a,13,b8,7a,eb,37,d3,01,14,\
00,56,00,31,00,00,00,00,00,3c,4b,18,17,11,00,54,61,73,6b,42,61,72,00,40,00,\
09,00,04,00,ef,be,3b,4b,22,aa,3c,4b,17,17,2e,00,00,00,a3,90,03,00,00,00,02,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2a,08,bb,00,54,00,61,00,73,00,\
6b,00,42,00,61,00,72,00,00,00,16,00,3a,01,32,00,23,05,00,00,3c,4b,6b,01,20,\
00,49,4e,54,45,52,4e,7e,31,2e,4c,4e,4b,00,00,aa,00,09,00,04,00,ef,be,3c,4b,\
17,17,3c,4b,17,17,2e,00,00,00,42,71,01,00,00,00,07,00,00,00,00,00,00,00,00,\
00,5a,00,00,00,00,00,f6,e1,c9,00,49,00,6e,00,74,00,65,00,72,00,6e,00,65,00,\
74,00,20,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,6c,00,6e,\
00,6b,00,00,00,40,00,43,00,3a,00,5c,00,57,00,49,00,4e,00,44,00,4f,00,57,00,\
53,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,65,\
00,34,00,75,00,69,00,6e,00,69,00,74,00,2e,00,65,00,78,00,65,00,2c,00,2d,00,\
37,00,33,00,31,00,00,00,1c,00,52,00,00,00,1d,00,ef,be,02,00,4d,00,69,00,63,\
00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,49,00,6e,00,74,00,65,00,72,00,\
6e,00,65,00,74,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,44,\
00,65,00,66,00,61,00,75,00,6c,00,74,00,00,00,1c,00,22,00,00,00,1e,00,ef,be,\
02,00,55,00,73,00,65,00,72,00,50,00,69,00,6e,00,6e,00,65,00,64,00,00,00,1c,\
00,00,00,ff

“FavoritesChanges”=dword:00000017
“FavoritesVersion”=dword:00000003
“FavoritesRemovedChanges”=dword:00000003

 

Notes

Assuming you’re using redirected profiles with a locked down c: drive, here is my XML file with Start Menu and Pinned Items:

The important bit for Pinned Items (add your shortcuts here)

%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\

<?xml version=”1.0″ encoding=”utf-8″?>
<LayoutModificationTemplate
xmlns=”http://schemas.microsoft.com/Start/2014/LayoutModification”
xmlns:defaultlayout=”http://schemas.microsoft.com/Start/2014/FullDefaultLayout”
xmlns:start=”http://schemas.microsoft.com/Start/2014/StartLayout”
xmlns:taskbar=”http://schemas.microsoft.com/Start/2014/TaskbarLayout”
Version=”1″>
<LayoutOptions StartTileGroupCellWidth=”6″ StartTileGroupsColumnCount=”1″ />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth=”6″ xmlns:defaultlayout=”http://schemas.microsoft.com/Start/2014/FullDefaultLayout”>
<start:Group Name=”Custom Shortcuts” xmlns:start=”http://schemas.microsoft.com/Start/2014/StartLayout”>
<start:DesktopApplicationTile Size=”2×2″ Column=”0″ Row=”0″ DesktopApplicationLinkPath=”C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Custom Icon.lnk” />
<start:DesktopApplicationTile Size=”2×2″ Column=”2″ Row=”0″ DesktopApplicationLinkPath=”C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk” />
<start:Tile Size=”2×2″ Column=”0″ Row=”2″ AppUserModelID=”Microsoft.WindowsCalculator_8wekyb3d8bbwe!App” />
<start:DesktopApplicationTile Size=”2×2″ Column=”4″ Row=”0″ DesktopApplicationLinkPath=”C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk” />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
<CustomTaskbarLayoutCollection PinListPlacement=“Replace”>
<defaultlayout:TaskbarLayout>
<taskbar:TaskbarPinList>
<taskbar:DesktopApp DesktopApplicationLinkPath=”%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk” />
<taskbar:DesktopApp DesktopApplicationLinkPath=”%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Custom Icon.lnk” />
<taskbar:DesktopApp DesktopApplicationLinkPath=”%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Google Chrome.lnk” />
<taskbar:DesktopApp DesktopApplicationLinkPath=”%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Internet Explorer.lnk” />
</taskbar:TaskbarPinList>
</defaultlayout:TaskbarLayout>
</CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

Windows 10 – Example Start Menu Layout Registry Keys & XML

email me

This is Chrome and the Calculator app on the tile layout

Snapshot

 

Reg Keys

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{479D4524-9CAF-40ED-8DB3-9801F051641B}Machine\Software\Policies\Microsoft\Windows\Explorer]
“LockedStartLayout”=dword:00000001
“StartLayoutFile”=hex(2):43,00,3a,00,5c,00,4c,00,61,00,79,00,6f,00,75,00,74,00,\
4d,00,6f,00,64,00,69,00,66,00,69,00,63,00,61,00,74,00,69,00,6f,00,6e,00,2e,\
00,78,00,6d,00,6c,00,00,00

 

or this…

reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer” /v “LockedStartLayout” /t REG_DWORD /d 1 /f

reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer” /v “StartLayoutFile” /t REG_BINARY /d 43003a005c004c00610079006f00750074004d006f00640069006600690063006100740069006f006e002e0078006d006c000000 /f

 

LayoutModification.xml

<LayoutModificationTemplate xmlns:defaultlayout=”http://schemas.microsoft.com/Start/2014/FullDefaultLayout” xmlns:start=”http://schemas.microsoft.com/Start/2014/StartLayout” Version=”1″ xmlns=”http://schemas.microsoft.com/Start/2014/LayoutModification”>
<LayoutOptions StartTileGroupCellWidth=”6″ />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth=”6″>
<start:Group Name=””>
<start:DesktopApplicationTile Size=”2×2″ Column=”0″ Row=”0″ DesktopApplicationLinkPath=”%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk” />
<start:Tile Size=”2×2″ Column=”2″ Row=”0″ AppUserModelID=”Microsoft.WindowsCalculator_8wekyb3d8bbwe!App” />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>

Windows 10 – Prevent Edge from Hijacking Associations

email me

GPO – User Preferences (set via domain or local GP)

DisallowDefaultBrowserPrompt
HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main
REG_DWORD
DisallowDefaultBrowserPrompt = 1

NoStaticDefaultVerb
HKCU\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
REG_SZ
NoStaticDefaultVerb = (Blank)

NoOpenWith
HKCU\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
REG_SZ
NoOpenWith = (Blank)

NoOpenWith
HKCU\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9
REG_SZ
NoOpenWith = (Blank)

 

Reg Keys (apply during login)

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9” /v NoStaticDefaultVerb /t REG_SZ /f

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723” /v NoStaticDefaultVerb /t REG_SZ /f

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723” /v NoOpenWith /t REG_SZ /f

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9” /v NoOpenWith /t REG_SZ /f

Windows 10 – Set PDF Default Application – UserChoice – File Association

email me

In Windows 10 build 1703 (as well as some previous builds), the full upgrade or Windows Servicing upgrade, the Edge browser breaks the PDF file association (meaning, you are forced to use Edge by default), and there is no automated method to fix it for current users. Microsoft uses the UserChoice reg to provide a unique hash for each file association in the user’s profile. While this offers a more secure method for handling file associations, it also presents several problems when trying to automate changing the app associated with each file extension. This is the research I have done, along with developing a couple solutions myself.


About UserChoice

The UserChoice registry key is used to associate file extensions with specific applications chosen by the user.

This key is located under the following registry path:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\

Within the FileExts key, there are subkeys for each file extension associated with the user’s choice. For example, if the user has chosen to open .txt files with Notepad, there will be a subkey named “.txt” under FileExts.

Under each file extension subkey, there is a subkey named “UserChoice.” This UserChoice subkey contains information about the user’s preferred application for opening files with that specific extension. This information typically includes the ProgId (Program Identifier) of the chosen application.

Here is a basic breakdown of the structure: HKEY_CURRENT_USER

HKEY_CURRENT_USER
  │
  └── Software
    │
    └── Microsoft
      │
      └── Windows
        │
        └── CurrentVersion
          │
          └── Explorer
            │
            └── FileExts
              │
              └── .ext (File extension, e.g., .txt)
                │
                └── UserChoice
                  │
                  └── ProgId (Identifier for the chosen application)

The ProgId value under the UserChoice subkey represents the Program Identifier associated with the chosen application. This ProgId is typically used by Windows to locate the appropriate application when opening files with the associated extension.

It’s important to note that the UserChoice settings are specific to each user profile on a Windows system. Each user can have their own set of file associations configured through the UserChoice registry key.

The purpose of UserChoice is to provide users with control over which applications are used to open specific file types, allowing them to customize their file associations based on personal preferences and workflow requirements. This feature enhances usability and flexibility within the Windows operating system.


On to some of the solutions…


Adobe’s Solution (not great)

https://helpx.adobe.com/acrobat/kb/not-default-pdf-owner-windows10.html


GP Method

If you can use GP, I recommend using it—either local or domain.

Start by setting the default PDF app(s) and then exporting the defaultassociations.xml file

Dism /Online /Export-DefaultAppAssociations:c:\defaultassociations.xml


Defaultassociations.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<DefaultAssociations>
<Association Identifier=”.acrobatsecuritysettings” ProgId=”AcroExch.acrobatsecuritysettings” ApplicationName=”Adobe Reader” />
<Association Identifier=”.fdf” ProgId=”AcroExch.FDFDoc” ApplicationName=”Adobe Reader” />
<Association Identifier=”.htm” ProgId=”IE.AssocFile.HTM” ApplicationName=”Internet Explorer” />
<Association Identifier=”.html” ProgId=”IE.AssocFile.HTM” ApplicationName=”Internet Explorer” />
<Association Identifier=”.mht” ProgId=”IE.AssocFile.MHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”.mhtml” ProgId=”IE.AssocFile.MHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”.partial” ProgId=”IE.AssocFile.PARTIAL” ApplicationName=”Internet Explorer” />
<Association Identifier=”.pdf” ProgId=”AcroExch.Document.11″ ApplicationName=”Adobe Reader” />
<Association Identifier=”.pdfxml” ProgId=”AcroExch.pdfxml” ApplicationName=”Adobe Reader” />
<Association Identifier=”.pdx” ProgId=”PDXFileType” ApplicationName=”Adobe Reader” />
<Association Identifier=”.svg” ProgId=”IE.AssocFile.SVG” ApplicationName=”Internet Explorer” />
<Association Identifier=”.url” ProgId=”IE.AssocFile.URL” ApplicationName=”Internet Browser” />
<Association Identifier=”.website” ProgId=”IE.AssocFile.WEBSITE” ApplicationName=”Internet Explorer” />
<Association Identifier=”.xdp” ProgId=”AcroExch.XDPDoc” ApplicationName=”Adobe Reader” />
<Association Identifier=”.xfdf” ProgId=”AcroExch.XFDFDoc” ApplicationName=”Adobe Reader” />
<Association Identifier=”.xht” ProgId=”IE.AssocFile.XHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”.xhtml” ProgId=”IE.AssocFile.XHT” ApplicationName=”Internet Explorer” />
<Association Identifier=”acrobat” ProgId=”acrobat” ApplicationName=”Adobe Reader” />
<Association Identifier=”ftp” ProgId=”IE.FTP” ApplicationName=”Internet Explorer” />
<Association Identifier=”http” ProgId=”IE.HTTP” ApplicationName=”Internet Explorer” />
<Association Identifier=”https” ProgId=”IE.HTTPS” ApplicationName=”Internet Explorer” />
<Association Identifier=”mk” ProgId=”IE.HTTP” ApplicationName=”Internet Explorer” />
<Association Identifier=”res” ProgId=”IE.HTTP” ApplicationName=”Internet Explorer” />
</DefaultAssociations>


You can apply the GP via a reg key

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]
“DefaultAssociationsConfiguration”=”c:\\defaultassociations.xml”


This could also be handled in an offline manner

Dism /Mount-Image /ImageFile:C:\mount\images\install.wim /Name:”Windows” /MountDir:C:\mount\offline

Dism.exe /Image:C:\mount\offline /Import-DefaultAppAssociations:c:\defaultassociations.xml

This, if you change your mind and would like to remove…

Dism.exe /Image:C:\mount\offline /Remove-DefaultAppAssociations


Notes

Don’t forget about ‘New Users’ or the default user profile

copy /y defaultassociations.xml \\%computername%\c$

reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System” /v DefaultAssociationsConfiguration /t REG_SZ /d “c:\defaultassociations.xml”

:: ADOBE ACROBAT READER 11
if exist “c:\Program Files (x86)\Adobe\Reader 11.0\Reader\” (

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\AcroRd32.exe\shell\open\command /ve /d “\”C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe\” \”%%1\”” /f >nul

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AcroRd32.pdf\shell\open\command /ve /d “\”C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe\” \”%%1\”” /f >nul

reg add HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications /d “AcroRd32″=”Software\AcroRd32\Capabilities” /f >nul

reg add HKEY_LOCAL_MACHINE\SOFTWARE\AcroRd32\Capabilities /v “ApplicationDescription” /d “AcroRd32 reads PDF files.” /f >nul

reg add HKEY_LOCAL_MACHINE\SOFTWARE\AcroRd32\Capabilities /v “ApplicationName” /d “AcroRd32” /f >nul

reg add HKEY_LOCAL_MACHINE\SOFTWARE\AcroRd32\Capabilities\FileAssociations /v “.pdf” /d “AcroRd32.pdf” /f >nul

reg add “HKEY_CURRENT_USER\SOFTWARE\Adobe\CommonFiles\Usage\Reader 11” /v OptIn /t REG_DWORD /d 0 /f
)

PAUSE


Filetype handler enforcement via a GPO policy

To set Acrobat Reader or Acrobat as default PDF file type handler:

  1. Download the sample file association files. These files include all the file types supported by Acrobat and Reader with their DC. To create your own XML files:

    1. Run an elevated command prompt on a machine that has your default application set correctly.
    2. Type Dism /Online /Export-DefaultAppAssociations:<XML path>\AppAssoc.xml. This creates an XML file that has all your file types and their current associations.
    3. Edit the XML file to include only the file associations that you wish to enforce.

You can create different files for different groups in your organization. For example, you can have one group that has Adobe Reader set as default and another that uses Adobe Acrobat.

  1. Place this XML on a shared network location or push this XML to all your machine-specific locations via a script. For example, C:\Windows\System32 (do not use a user-specific location).

  2. Set the XML configured with your preferences in a Windows 8 Group Policy setting, and enable the setting as follows:

    1. Open up the Group Policy MMC (open a command prompt and type gpedit.msc) on your Server instance.
    2. Locate the policy under Computer Configuration\Administrative Templates\Windows Components\File Explorer\Set a default associations configuration file. This policy specifies the path for the XML file that can be either stored locally or on a network location.
    3. Enable the policy, and specify the location where you have stored the XML file. The corresponding registry entry is HKLM\Software\Policies\Microsoft\Windows\System\DefaultAssociationsConfiguration.


Prevent Edge from hijacking file associations

GPO – User Preferences

DisallowDefaultBrowserPrompt
HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main
REG_DWORD
DisallowDefaultBrowserPrompt = 1

NoStaticDefaultVerb
HKCU\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
REG_SZ
NoStaticDefaultVerb = (Blank)

NoOpenWith
HKCU\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
REG_SZ
NoOpenWith = (Blank)

NoOpenWith
HKCU\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9
REG_SZ
NoOpenWith = (Blank)


Reg Keys (apply during login)

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9” /v NoStaticDefaultVerb /t REG_SZ /f

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723” /v NoStaticDefaultVerb /t REG_SZ /f

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723” /v NoOpenWith /t REG_SZ /f

REG ADD “HKEY_CURRENT_USER\Software\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9” /v NoOpenWith /t REG_SZ /f


Other

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf]

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf]

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithList]
“a”=”Acrobat.exe”
“MRUList”=”a”

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithProgids]
“Acrobat.Document.2015″=hex(0):


UserChoice Engineering Details 

The contents of the UserChoice subkey dictate the default application for opening the file type:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts

Microsoft fails to detect the user’s original PDF reader (intentionally, I’m guessing), thus preventing the generation of a new UserChoice hash. If the hash is not correct, Edge becomes the default reader. This is why the Edge browser is becoming the default PDF reader—MS just didn’t put the correct logic in to detect every possible version of Reader, Pro, Standard.


SUPER SECRET USERCHOICE HASH

extension = “.pdf”
SID = “S-1-5-21-5237425623-0426251624-7215293041-1001”
UserProgID = “AcroReader.DC”
RegDate = “01d2449a35746500”
Experience = “Secret String”


PROGRAMMING LOGIC

#1 Return timestamp of UserChoice reg key (yes, reg keys have timestamps):

HKEY_USERS\S-1-5-21-5237425623-0426251624-7215293041-1001\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice


#2 Fill Buffer with Values:

extension, SID, ProgId, timestamp, static string


#3 Hash and Encode Buffer:

Base64(MicrosoftHash(MD5(toLower(Extension, SID, ProgId, RegDate, Experience))))


Bask in the glory of success…

tags: Microsoft User Choice hashes, MrNetTek

VBScript – Create Automated Remote Assistance Session

email me

Using VBScript, I was able to automate the Microsoft Remote Assistance. The script leverages Gmail, MSRA.exe, a capture tool, and nircmd. By doing so, Remote Assistance is launched, the incident is captured, the RA code is captured, an email is started, and the RA code is pasted from clipboard.

' RUN LOCALLY ON COMPUTER
' REMOTE ASSISTANCE MUST BE ENABLED IN GP

ON ERROR RESUME NEXT

Dim objShell, objFSO, strTemp, strRAIncident, strURL, strEmail, strSubject, strBody, strComputer, browserApp, actionCommand, charCheck, strSerial

Set objShell = CreateObject("WScript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")

'EMAIL - WHO RECEIVES THE INCIDENT

strEmail = "ONE@emailaddress.com"
'strEmail = "ONE@emailaddress.com;TWO@emailaddress.com"


'SUBJECT

serial()

strUser = CreateObject("WScript.Network").UserName

strComputer = objShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )

strSubject = "[Remote" & "+" & "Control]" & "+" & strUser & "+" & strComputer & "+" & strSerial


'URL

strURL = "https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to="&strEmail&"&su="&strSubject&"&body=" & chr(34)


'BROWSER TO USE
browserApp = "Chrome"


' S E Q U E N C I N G

'1 - IS CHROME RUNNING
CheckProcess()

'2 - CREATE INCIDENT FILE USING MSRA.EXE - VERIFIES DATA
GenerateIncident()

'Paste Password
objShell.AppActivate "Windows Remote Assistance"
WScript.Sleep 500
objShell.AppActivate "Windows Remote Assistance"
'capture image of remote assistance window
objShell.Run "C:\RemoteAssistance\cap.exe /quality=100 /active /file=" & "remote.jpg",9,true
objShell.AppActivate "Windows Remote Assistance"
'add capture to clipboard
objShell.Run "C:\RemoteAssistance\nircmd.exe clipboard copyimage remote.jpg",0,true
WScript.Sleep 500

'3 - CREATE ACTION COMMAND
actionCommand = "Chrome" & " " & strURL & strRAIncident

'4 - RUN ACTION COMMAND
objShell.AppActivate "Chrome"
'launch Chrome, GMail
objShell.Run actionCommand,9,false

'ADD SNAPSHOT
'wait X amount of time
WScript.Sleep 8000
objShell.AppActivate "Chrome"
objShell.SendKeys "MICROSOFT REMOTE ASSISTANCE"
WScript.Sleep 500
objShell.SendKeys "+{ENTER}"
objShell.SendKeys "+{ENTER}"
objShell.SendKeys "________________"
'objShell.SendKeys "^v"
objShell.Run "C:\RemoteAssistance\nircmd.exe sendkeypress Ctrl+V",9,true
objShell.SendKeys "________________"
objShell.SendKeys "+{ENTER}"
objShell.SendKeys "+{ENTER}"
objShell.SendKeys "~"


'If you want to send email automatically
'objShell.SendKeys "^{ENTER}"
'WScript.Sleep 2000
'objShell.SendKeys "^{ENTER}"

'SHIFT use + 
'CTRL use ^ 
'ALT use %

'SESSION CLEANUP
objShell.Run "%comspec% /c del /q C:\RemoteAssistance\remote.msrcincident",0,true
objShell.Run "%comspec% /c del /q C:\RemoteAssistance\remote.jpg",0,true

objShell = ""
objFSO = ""
strTemp = ""
strRAIncident = ""
strURL = ""
strEmail = ""
strSubject = ""
strBody = ""
strComputer = ""
browserApp = ""
actionCommand = ""
charCheck = ""
strSerial = ""

WScript.Quit



'SUBS HERE


sub GenerateIncident()
	
    'launch loading...
	objShell.run "c:\RemoteAssistance\loading.exe c:\RemoteAssistance\loading.hta",9,false
	
	'clear previous session
	objShell.Run "taskkill /f /im msra.exe",0,true
	objShell.Run "%comspec% /c del /q remote.msrcincident",0,true
	strTemp = ""		
	WScript.Sleep 2000

	'kill splash
	objShell.Run "taskkill /f /im loading.exe",0,false
		
	'start new session
	objShell.Run "%comspec% /c msra.exe /saveasfile remote",0,false

	'wait for incident to be created
	If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000
	If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000
	If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000
	If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000
	
	'makes sure incident exists
	If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then 	 
		
		msgbox "Missing Microsoft Incident File. Check the remote assistance settings on the computer and try again.",48,"Alert"
	 
		WScript.Quit()	 
	 
	end if	
	
	strTemp = objFSO.OpenTextFile("remote.msrcincident").ReadAll()
	

	'some minor checks of the incident file itself
	
	'if ampersand exists, recreate incident
	'URL encoding uses ampersands to separate content
	If inStr(strTemp, "&") Then	call GenerateIncident()	
	
	'replace double quotes
	'corrected for URL encoding
	strRAIncident = Replace(strTemp, """", "%22")

	'replace hashtag
	'corrected for URL encoding
	strRAIncident = Replace(strRAIncident, "#", "%23")

	'check to see if space exists in password stub
	'the incident has issues with spaces when emailing, so recreate incident
	charCheck = Right(strRAIncident,111)
	charCheck = "X" & left(charCheck,1) & "X"	
	If charCheck = "X X"  then call GenerateIncident()	

end sub



sub CheckProcess()

	'check to see if Chrome is open
 
	Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

	Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = " & "'"&browserApp&".exe'")

	If colProcesses.Count = 0 Then
	
		msgbox "Please log into Gmail and launch again!",48,"Alert"
	
		WScript.Quit

	End If
	
	
	'check to see if Remoate Assistance is closed
	
	Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
	
	Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = " & "'msra.exe'")

	If colProcesses.Count <> 0 Then
	
		msgbox "Please close existing Remote Assistance session and launch again!",48,"Alert"
	
		WScript.Quit

	End If

end sub	
	
	


sub Serial()
   
     'returns serial

	on error resume next
	
	strComputer = "."
     
	 Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     
	 Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS")
     
	 For Each objItem in colItems
     
		strSerial = objItem.SerialNumber
     
	 next

end sub

SCCM – Allow Remote Control Without Permission

email me

This is how you would allow SCCM remote control to work without the user’s permission. If it doesn’t work initially, check the registry remote service on the computer you’re trying to connect to, and make sure you have the appropriate rights.

OPTION EXPLICIT

DIM strComputer, regPath, regValue, regData, objReg

CONST HKEY_LOCAL_MACHINE = &H80000002 

strComputer = InputBox("Enter computer name: ","SCCM Remote Control")  
 
If strComputer <> "" Then 

  Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") 
 
  regPath = "SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control" 

  regValue = "Permission Required"

  'remove old key 
  objReg.DeleteValue HKEY_LOCAL_MACHINE,regPath,regValue  

  regData = 0

  'create new key
  objReg.SetDWORDValue HKEY_LOCAL_MACHINE,regPath,regValue,regData 

  Msgbox "Remote Control Granted!",64 ,"Alert"

End If


'clear session
strComputer = ""
regPath = ""
regValue = ""
regData = ""
objReg = ""

VBScript – Write Specific Hard Drive Attributes to Registry

email me

I’m using this to add hard drive attributes to the registry, so the specs can be imported into a Custom table in the LANDesk database.

on error resume next

Const HARD_DISK = 3

strComputer = "."

Set objShell = CreateObject("WScript.Shell")

RegPath = "hklm\software\HD_Specs"


'RETURN ALL LOCAL HARD DRIVES

Set objWMIService = GetObject("winmgmts:"  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colDisks = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk")

For Each objDisk in colDisks 
 
Select Case objDisk.DriveType

 Case 1
	'Wscript.Echo "No root directory."
 Case 2
	'Wscript.Echo objDisk.DeviceID  & " Removable drive."
	
 Case 3
		 objShell.Run "reg add " & chr(34) & RegPath & chr(34) " /v Drive_" & objDisk.DeviceID & " /t REG_SZ /d " & " ""Local hard disk"" "  & " /reg:64 /f",0,true
 Case 4
	'Wscript.Echo objDisk.DeviceID  & " Network disk." 
 Case 5
	'Wscript.Echo objDisk.DeviceID  & " Compact disk." 
 Case 6
	'Wscript.Echo objDisk.DeviceID  & " RAM disk." 
Case Else
	'Wscript.Echo objDisk.DeviceID  & " Drive type could not be determined." 
End Select

Next


Set objWMIService = GetObject("winmgmts:"  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & " AND DeviceID = 'C:'")

'FREE SPACE
For Each objDisk in colDisks   
   
   numSize = FormatNumber(objDisk.FreeSpace /(1024^3), 3 )
   
   numSize = left(numSize, len(numSize) -1 )
   
   objShell.Run "reg add " & chr(34) & RegPath & chr(34) " /v FreeSpace /t REG_SZ /d " & numSize  & " /reg:64 /f",0,true

Next

numSize = ""


'SIZE
For Each objDisk in colDisks   

   numSize = Int(objDisk.Size /1073741824)   

   objShell.Run "reg add " & chr(34) & RegPath & chr(34) " /v TotalSize /t REG_SZ /d " & numSize  & " /reg:64 /f",0,true

Next


'DIRTY BIT
For Each objDisk in colDisks   
   
   objShell.Run "reg add " & chr(34) & RegPath & chr(34) " /v DirtyBit /t REG_SZ /d " & objDisk.VolumeDirty  & " /reg:64 /f",0,true
   
Next


'MODEL
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive")

For Each objItem in colItems	

	objShell.Run "reg add " & chr(34) & RegPath & chr(34) " /v Model /t REG_SZ /d " & chr(34) & objItem.Model & chr(34) & " /reg:64 /f",0,true

Next

objShell.Run "cmd /c " & chr(34) & "C:\Program Files (x86)\LANDesk\LDClient\LDISCN32.EXE" & chr(34) & " /F /SYNC",0,true

WScript.Quit

SCCM – Computer Won’t Show up in Devices

email me

Occasionally, SCCM will have a hiccup, and ‘Blocked’ machines may lose visibility in the Devices – All Systems collection. So much fun.

For example, when a machine is blocked, normally you can just see the blocked status in the column header Blockedit will say Yes or No—and you can easily change that status from the right-click menu. But, for some reason, SCCM will decide not to show the machine. Well, then…how do you unblock it??? The answer is to query the database, find the missing machine, and to Update the record to an unblock status.

On the CM Database, run this query

SELECT * FROM ClientKeyData WHERE IsRevoked = 1

That will list all of the clients that have been blocked.

 

Now, you could just unblock all of them using this SQL command

UPDATE ClientKeyData set IsRevoked = 0 WHERE IsRevoked = 1

 

Or, be selective, using these commands, assuming you can find the exact SMSID

SELECT * FROM ClientKeyData WHERE SMSID in (‘GUID:E0C8BBA7-142D-1628-A147-328AD3DA39CA’)

UPDATE ClientKeyData set isrevoked = 0 WHERE IsRevoked = 1

Batch – Repair Windows Updates

email me

I am using this with imaging in SCCM to repair Windows Updates.

@echo off
c:
net stop wuauserv
net stop bits
net stop cryptsvc
del /q "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
ren %systemroot%\system32\catroot2 catroot2.old
ren %systemroot%\SoftwareDistribution SoftwareDistribution.old
sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
cd /d %windir%\system32
regsvr32.exe atl.dll /s
regsvr32.exe urlmon.dll /s
regsvr32.exe mshtml.dll /s
regsvr32.exe shdocvw.dll /s
regsvr32.exe browseui.dll /s
regsvr32.exe jscript.dll /s
regsvr32.exe vbscript.dll /s
regsvr32.exe scrrun.dll /s
regsvr32.exe msxml.dll /s
regsvr32.exe msxml3.dll /s
regsvr32.exe msxml6.dll /s
regsvr32.exe actxprxy.dll /s
regsvr32.exe softpub.dll /s
regsvr32.exe wintrust.dll /s
regsvr32.exe dssenh.dll /s
regsvr32.exe rsaenh.dll /s
regsvr32.exe gpkcsp.dll /s
regsvr32.exe sccbase.dll /s
regsvr32.exe slbcsp.dll /s
regsvr32.exe cryptdlg.dll /s
regsvr32.exe oleaut32.dll /s
regsvr32.exe ole32.dll /s
regsvr32.exe shell32.dll /s
regsvr32.exe initpki.dll /s
regsvr32.exe wuapi.dll /s
regsvr32.exe wuaueng.dll /s
regsvr32.exe wuaueng1.dll /s
regsvr32.exe wucltui.dll /s
regsvr32.exe wups.dll /s
regsvr32.exe wups2.dll /s
regsvr32.exe wuweb.dll /s
regsvr32.exe qmgr.dll /s
regsvr32.exe qmgrprxy.dll /s
regsvr32.exe wucltux.dll /s
regsvr32.exe muweb.dll /s
regsvr32.exe wuwebv.dll /s

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX /v IsConvergedUpdateStackEnabled /t REG_DWORD /d 00000000 /f
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v UxOption /t REG_DWORD /d 00000000 /f
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control /v RegistrySizeLimit /t REG_SZ /d 4294967295 /f
netsh winsock reset
netsh winhttp reset proxy
sc config bits start= Auto
sc config AppIDSvc start= Auto
sc config Appinfo start= Auto
net start bits
net start wuauserv
net start appidsvc
net start cryptsvc

wuauclt /resetauthorization /detectnow
ping -n 60 127.0.0.1>nul
pause