COOPER143
asked on
Scripting
hello,
i'm trying to delete network printers via a registry key in a login script. I'm trying to make this registry key addition run silently, but everytime I test it a box comes up saying "Are you sure you want to add the information to the registry?"
Can anyone help?
The Registry key is:
Windows Registry Editor Version 5.1
[-HKEY_CURRENT_USER\Printe rs\Connect ions]
regedit.exe /s %LOGONSERVER%\DeleteAllPri nters.reg
i'm trying to delete network printers via a registry key in a login script. I'm trying to make this registry key addition run silently, but everytime I test it a box comes up saying "Are you sure you want to add the information to the registry?"
Can anyone help?
The Registry key is:
Windows Registry Editor Version 5.1
[-HKEY_CURRENT_USER\Printe
regedit.exe /s %LOGONSERVER%\DeleteAllPri
ASKER
I tried that..Same message?
I do not believe you can silently import into the registry using regedit. You can, however, do it with vbscript. The machines running the loginscript would have to be able to run vbscripts (it should be on most windows machines unless you have specifically removed it). Below is a sample script that reads a registry value, and if it is greater than or equal to 1, then it changes it to 0.
set wscr=CreateObject("WScript .Shell")
rr=wscr.RegRead("HKEY_CURR ENT_USER\S oftware\Mi crosoft\Wi ndows Scripting Host\Settings\Timeout")
if (rr>=1) then
wscr.RegWrite "HKEY_CURRENT_USER\Softwar e\Microsof t\Windows Scripting Host\Settings\Timeout",0," REG_DWORD"
end if
set wscr=CreateObject("WScript
rr=wscr.RegRead("HKEY_CURR
if (rr>=1) then
wscr.RegWrite "HKEY_CURRENT_USER\Softwar
end if
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi COOPER143,
And, yes, you can use REGEDIT /S to update the registry silently.
If you are determined to use the registry (instead of oBdA's elegant answer) you may want to try using the "REG DELETE /?" command and view the options presented there.
pb
And, yes, you can use REGEDIT /S to update the registry silently.
If you are determined to use the registry (instead of oBdA's elegant answer) you may want to try using the "REG DELETE /?" command and view the options presented there.
pb
ASKER
I forgot about the con2prt.exe /f....
It worked great!
Thanks for everyone's help.
It worked great!
Thanks for everyone's help.
Many Regards
Jorgen Malmgren
IT-Supervisor
Denmark