namerg
asked on
How delete printer names and tcp/ip ports ?
I am stuck in removing certain printers with tcp/ip ports using Remove-PrinterPort. I get the following error
Remove-PrinterPort -Name "PA-HP Plotter"
Remove-PrinterPort: No MSFT_PrinterPort objects found with property 'Name' equal to 'PA-HP Plotter'. Verify the value of the property and retry.
My first goal is to verify if the following printer names exist "HP Printer PS",
"Xerox B215 Multifunction Printer PS" and "PA-HP Plotter" and delete them if they do exist with the respective ports.
Thansk for your help
ASKER
Yep, I have tried Get-PrinterPort and queries fine with the expected results..
Ah understood. Perhaps check the -Name value you are using. Is it exact? One way I can imagine might work.
$getports = Get-PrinterPort
$thisport = $getPorts[0] # assuming its the first one.
Then Remove-PrinterPort -Name $thisPort.Name
Just thinking out loud, possibly the value stored is different than what is being entered?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hmm, will try both suggestions later
ASKER
ASKER
Well, I guess it does not impact what I am trying to accomplish. I did add the printer via powershell using the same tcp/ip port and was added fine. Thanks for your input anyway
I'm not that familiar with this specific one, but have you tried first querying with Get-PrinterPort and then If (something something) { then do the stuff}? Just worth checking.