• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 574
  • Last Modified:

Adding a registry key during vb logon script

I currently get an error on my logon script intermittently. It states:

CMD.EXE was st arted with the avove path as the current directory.
UNC pats are not supported. Defaulting to Windows directory.

After doing research, I found that I need ti add the value DisableUNCCheck REG_DWORD and set the value to 0 x 1 (Hex).

Any help with adding this key in my script? Thank you.

  • 2
1 Solution
Shanmuga SundaramDirector of Software EngineeringCommented:
you can find few examples on working with windows registry here

Neil2526Author Commented:
Thanks for the link shasunder -

but that site shows how to edit a current key, i need to create a command similar to this:

REG ADD "HKCU\Software\Microsoft\Command Processor" /V DisableUNCCheck /T REG_DWORD /F /D 1
try this
const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Command Processor"
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "DisableUNCCheck"
dwValue = 1
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

Open in new window

this is the full script save as vbs
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now