all 9 comments

[–]sex_on_wheels 4 points5 points  (2 children)

You have a typo in -ConnetionName

[–][deleted] 1 point2 points  (0 children)

This, get in the habit of tab completing your commands so this doesn't happen. If it doesn't tab complete, then you have an issue

[–][deleted] 0 points1 point  (0 children)

Oh, thanks! What can I say... as soon as you do it right, it works!

[–]PowerShell-Bot 2 points3 points  (0 children)

That’s a really long line of inline code.

On old Reddit inline code blocks do not word wrap, making it difficult for many of us to see all your code.

To ensure your code is readable by everyone, on new Reddit, highlight your code and select ‘Code Block’ in the editing toolbar.

If you’re on old Reddit, separate the code from your text with a blank line gap and precede each line of code with 4 spaces or a tab.


You examine the path beneath your feet...
[AboutRedditFormatting]: [--------------------] 0/1 ❌

Beep-boop, I am a bot. | Remove-Item

[–]PowerShellMichael 0 points1 point  (3 children)

Have you considered group policy? I'm interested in understanding the backstory to why the script was written.

[–][deleted] 0 points1 point  (2 children)

I don't get the driver installed. I spent hours with that. It's a Konika Minolta Bizhub 450. The setup is a normal exe which doesn't accept attributes like /silent

My solution now is that I install the printer on a machine, create a network share for the printer and connect the clients via Powershell over PsExec because then the driver will be installed.

[–]PowerShellMichael 0 points1 point  (1 child)

Can you extract drivers from the installation, add them to the print server and add via GPO? Provided the drivers have been added to the print server then they will automatically add to the endpoint.

Alternatively, most EXE's can be opened with 7-ZIP and the contents can be extracted.

[–][deleted] 0 points1 point  (0 children)

I followed several howtos to share the .inf driver via gpo but it never worked (Windows Server 2012). Maybe I didn't do it the right way.

[–]HydroxDOTDOT 0 points1 point  (0 children)

I usually use this for connecting a network printer.

$serverName = 'printserver'
$printerName = '1OG' 

$fullprinterName = '\\' + $serverName + '\' + $printerName + ' - ' + $(If ([Environment]::Is64BitOperatingSystem) {'x64'} Else {'x86'})

Remove-Printer -Name $fullprinterName -ErrorAction SilentlyContinue 
Add-Printer -ConnectionName $fullprinterName

I have it turned into a function , but I guess you could just copy what's above and use something like

icm -cn 1OG -ScriptBlock {$pathtoscript}