This script runs with a group policy and locks the desktop down. I noticed in frequent cases that it leaves the control panel in the Start Menu either though I have it hidden in the script. When i logoff and log back on it finally disappears.
Any ideas?
Option Explicit
'Declare variables
Dim WSHShell, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, q, p, z, NN, FS
Dim itemtype, errnum
Set WSHShell = WScript.CreateObject("WScr
ipt.Shell"
)
b = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
b = b & "NoSetTaskbar" 'This restriction removes the Taskbar and Start Menu item from the Control Panel, and it also removes the Properties item from the Start menu context menu
d = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
d = d & "NoSimpleStartMenu" 'This restriction forces users to use the classic Windows start menu, instead of the new format introduced with Windows XP.
e = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
e = e & "NoTrayContextMenu" 'This setting removes the context menus (right click on the taskbar) for the system tray, including the Start button, Tab control, and Clock.
f = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
f = f & "NoFind" 'This restriction removes the Search feature from the Start Menu.
g = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
g = g & "NoDriveTypeAutoRun" 'Doesn't auto run CD
h = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
h = h & "NoRun" 'No Run menu
i = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
i = i & "NoSMHelp" 'No Help Menu
j = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
j = j & "NoRecentDocsMenu" 'doesn't cache recent docs menu
k = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
k = k & "StartMenuLogOff" 'no logoff
l = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
l = l & "NoCommonGroups"
m = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
m = m & "NoSetFolders" 'This restriction removes the Control Panel, Printers and Network Connection settings from the Start menu. If the Taskbar settings are also hidden it causes the Settings menu to be completely removed.
o = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
o = o & "NoDrives" 'NO C drive
p = "HKCU\Software\Policies\Mi
crosoft\In
ternet Explorer\Restrictions\"
p = p & "NoBrowserContextMenu"
q = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\System\"
q = q & "NoDispCPL" 'This option disables the display settings control panel icon, and stops users from accessing any display settings
z = "HKCU\Software\Microsoft\W
indows\Cur
rentVersio
n\Policies
\Explorer\
"
z = z & "NoViewContextMenu" 'no right click on desktop
itemtype = "REG_DWORD"
'-------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (d)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite d, 0, itemtype
End If
'-------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (p)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite p, 0, itemtype
End If
'------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (k)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite k, 0, itemtype
End If
'------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (z)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite z, 0, itemtype
End If
'------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (m)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite m, 0, itemtype
End If
'-------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (i)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite i, 0, itemtype
End If
'------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (j)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite j, 0, itemtype
End If
'-------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (b)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite b, 0, itemtype
End If
'--------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (e)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite e, 0, itemtype
End If
'--------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (o)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite o, 0, itemtype
End If
'--------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (f)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite f, 0, itemtype
End If
'---------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (h)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite h, 0, itemtype
End If
'--------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (g)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite g, 0, itemtype
End If
'--------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (q)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite q, 0, itemtype
End If
'--------------------
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (l)
On Error Goto 0
errnum = Err.Number
if errnum <> 0 then
'Create the registry key value for NoFolderOptions with value 0
WSHShell.RegWrite l, 0, itemtype
End If
'--------------------
'If the key is present, or was created, it is toggled
'Confirmations can be disabled by commenting out
'the two MyBox lines below
NN = 0
n = 1
a = 12
c = 181
WSHShell.RegWrite k, NN, itemtype
WSHShell.RegWrite l, n, itemtype
WSHShell.RegWrite i, n, itemtype
WSHShell.RegWrite j, n, itemtype
WSHShell.RegWrite d, n, itemtype
WSHShell.RegWrite p, n, itemtype
WSHShell.RegWrite z, n, itemtype
WSHShell.RegWrite m, n, itemtype
WSHShell.RegWrite b, n, itemtype
WSHShell.RegWrite e, n, itemtype
WSHShell.RegWrite o, a, itemtype
WSHShell.RegWrite f, n, itemtype
WSHShell.RegWrite g, c, itemtype
WSHShell.RegWrite h, n, itemtype
WSHShell.RegWrite q, n, itemtype
WSHShell.RegWrite m, n, itemtype
Start Free Trial