How do I make an exception for a user?

  • Thread starter Thread starter Mickey
  • Start date Start date
M

Mickey

I have the following script to set the users registry to
point to the H:\ drive. It maps My Documents to our file
server.

Dim WSHShell
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & strComputer
& "\root\default:StdRegProv")

strKeyPath
= "Software\Microsoft\Windows\CurrentVersion\Explorer\User
Shell Folders"
strEntryName = "Personal"
strValueName = "H:\"
objReg.GetStringValue HKEY_CURRENT_USER, strKeyPath,
strEntryName, strValue
'Wscript.Echo "The current Home Folder is " & strValue
If strValue <> "H;\" Then
objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath,
strEntryName, strValueName
End If

However, I have a few specific users that need to have an
exception made. in a KIX32 script it would look something
like this
If @userid = 'joeuser'
else
writevalue
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersi
on\Explorer\User Shell
Folders","Personal","h:\","REG_EXPAND_SZ")
endif

This would exclude the user joeuser from having this
registry change made to his system. (hint: joeuser is a
CFO)

My question is how would I do the same thing with the
vbscript?
 
Back
Top