Author Posts

January 1, 2012 at 12:00 am

by Zushakon at 2012-08-31 10:31:59


I would like to change sharename on one printer on a remote printserver. I know how to extract the data but i dont know how to update this data.

$koza = gwmi win32_printer -computername server | where-object {$_.sharename -eq "dupa"}
$koza.sharename = $koza.sharename.replace("dupa","ladnadupa")

but how to now update this on my printserver ?

Any help ?

by DonJ at 2012-08-31 10:40:01

I'm not sure you could do that via WMI or not – I don't know how, at least. The command-line described at can be used to share a printer – essentially, you'd create a new share name, and either keep or drop the old one. There's some additional information at ... -us;189105.

by Zushakon at 2012-08-31 11:11:57

Thx for the tip. I searched around a bit more and found a method – "put()"

Meaning the last line now is just


And it updates all perfetly 🙂

by DonJ at 2012-08-31 11:21:18

Ah... sorry, I was confused about what you were asking for. Apologies.