Link to home
Start Free TrialLog in
Avatar of COOPER143
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\Printers\Connections]


regedit.exe /s %LOGONSERVER%\DeleteAllPrinters.reg
Avatar of trywaredk
trywaredk
Flag of Denmark image

use regedit -s instead of regedit /s

Many Regards

Jorgen Malmgren
IT-Supervisor
Denmark
Avatar of COOPER143
COOPER143

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_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout")
if (rr>=1) then
wscr.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout",0,"REG_DWORD"
end if
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
I forgot about the con2prt.exe /f....

It worked great!

Thanks for everyone's help.