Jump to content

Setting Printers Based On Room Location


Recommended Posts

Posted
@DMcCoy Would love the WMI script ;)
you can do it within the vbs file, but again, this one has to run as the startup script (in fact I guess it can be a seperate startup script on its own).

 

I think this is the relevant bit, test it first :)

 

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery ("SELECT * FROM Win32_Printer")
For Each objPrinter in colInstalledPrinters
IF objPrinter.Name = "Microsoft Office Document Image Writer" THEN
	objPrinter.Delete_
END IF
Next

 

mind the word wrap

Posted

which is... [hehe]

 

Is that it? is that the path? - not a reference to any specific path or machine - but syntax for the WMI root path generically?

Posted
which is... [hehe]

 

Is that it? is that the path? - not a reference to any specific path or machine - but syntax for the WMI root path generically?

 

It belongs on the end of the second line but got wrapped.

 

I don't know much about WMI, but I'm guessing the "." bit sets it to the local machine. You can see it in: Computer Managment, WMI Control then right click, properties, security.

Posted

Its a string concatination. The full path for the GetObject call ends up as:

 

winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2

 

First bit is the protocol (winmgmts), second bit is the impersonation level ({impersonationLevel=impersonate}) last bit is the path, the \\. means the local machine. You could use \\RANDOMSERVER01 instead if you wanted to access things remotely over the network. Last bit is the WMI root path as I've explained.

 

Why is it such an unobvious mess of ASCII? I've no idea, ask Microsoft.

  • 6 months later...
Posted

Am I allowed to do a blatant ad for a small utility I wrote and just uploaded to the download section?

 

Makes things a whole lot easier, no spyware or other junk, just posting something hopefully others will find useful.

 

http://printing.networkstuff.co.uk

 

for instructions and download.

 

:wink:

Posted

@klawd: Free utilities written by our members are welcomed and often encouraged. After all, why re-invent the wheel?

 

If you would like to open the source, I'm sure our members would love to help you develop it further.

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...