Jump to content

Recommended Posts

Posted

load regedit

go to hkey users

file load hive

point at your roaming profiles ntuser.dat/man

go to printers and delete whaever is there

 

as always before playing round with regedit backup the file or at least export the key you changed

Posted

OR

 

1. Create/change a user who a. logs on using that profile & b. has write access to the profile folder.

2. rename user.man to user.dat

3. log on as the user in step 1

4. delete the printers from the profile

5. log off again

6. rename user.dat back to user.man

Posted

Ok I now have this working. I am having trouble setting the default printer in the room. I am using the script below but how do I get it to select the deafult printer?

 

Option Explicit

DIM RegEntry, ComputerName

 

RegEntry="HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"

ComputerName = ReadRegValue(RegEntry)

 

if InStr(1,ucase(ComputerName),"LAB1-",vbTextCompare) > 0 then call SetPrinter("\\LAB1\LaserJet")

if InStr(1,ucase(ComputerName),"LAB2-",vbTextCompare) > 0 then call SetPrinter("\\LAB2\LaserJet")

if InStr(1,ucase(ComputerName),"OFFICE-",vbTextCompare) > 0 then call SetPrinter("\\OFFICE\LaserJet")

'so on and so forth.

wscript.quit

 

' *** This subroutine installs and sets the default printer

Sub SetPrinter(ByVal PrinterPath)

DIM WshNetwork

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection(PrinterPath)

WshNetwork.SetDefaultPrinter Printerpath

end sub

 

' **** This function returns the data in the registry value

Function ReadRegValue(ByVal RegValue)

DIM WSHShell

Set WSHShell = WScript.CreateObject("WScript.Shell")

ReadRegValue=""

On Error Resume Next

ReadRegValue= WSHShell.RegRead(RegValue)

End Function

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...