how to change printer port address on windows 7

%3CLINGO-SUB%20id%3D%22lingo-sub-1449847%22%20slang%3D%22en-US%22%3Ehow%20to%20change%20printer%20port%20address%20on%20windows%207%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1449847%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20hope%20you%20and%20your%20family%20are%20safe.%26nbsp%3B%3C%2FP%3E%3CP%3EB.L.M.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20running%20ps%20script%20to%20change%20remote%20pc%20printer%20driver%20port%20address.%20this%20works%20fine%20for%20windows%2010.%20However%20if%20the%20target%20pc%20is%20windows%207%20i%20get%20%22portname%22%20property%20doesn't%20exist%20.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EThe%20property%20'PortName'%20cannot%20be%20found%20on%20this%20object.%20Verify%20that%20the%20property%20exists%20and%20can%20be%20set.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eany%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1449847%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1449851%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20change%20printer%20port%20address%20on%20windows%207%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1449851%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F661200%22%20target%3D%22_blank%22%3E%40mpd53210%3C%2FA%3E%26nbsp%3Bfollow%20this%20link%20to%20solve%20any%20feature%20on%20your%20account%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Fwww.officehelpceneter.xyz%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ewww.officehelpceneter.xyz%3C%2FA%3E%26nbsp%3Band%20thank%20me%20later.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1449862%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20change%20printer%20port%20address%20on%20windows%207%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1449862%22%20slang%3D%22en-US%22%3Eduring%20debugging%20I%20saw%20that%20cimproperty%20has%20the%20portname%20property.%20however%20I%20do%20not%20know%20how%20to%20read%20or%20update%20it.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1449946%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20change%20printer%20port%20address%20on%20windows%207%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1449946%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20again.%20I%20have%20the%20following%20script.%20Every%20time%20I%20run%20it%20shows%20me%20an%20error.%3CBR%20%2F%3E%24a%3DGet-Printer%20-ComputerName%20%24pcname1%20%7C%20Where-Object%20%7B%24_.%3CBR%20%2F%3EPortName%20-like%20%24OldIP%7D%26nbsp%3B%3CBR%20%2F%3E%24a.PortName%20%3D%20%24NewIP%3CBR%20%2F%3ESet-Printer%20-InputObject%20%24a%3CBR%20%2F%3E%3CBR%20%2F%3EI%20get%20this%20error%3CBR%20%2F%3EThe%20property%20'PortName'%20cannot%20be%20found%20on%20this%20object.%20Verify%20that%20the%20property%20exists%20and%20can%20be%20set%3CBR%20%2F%3Ethe%20error%20is%20on%20line%20for%20(%24a.PortName%20%3D%20%24NewIP)%3CBR%20%2F%3E%3CBR%20%2F%3Eduring%20debug%2C%20when%20I%20hover%20on%20%24a%20I%20can%20see%20properties%20of%20%24a%20and%20it%20has%20two%20printers%20showing.%20when%20I%20drill%20down%20into%20it%2C%20I%20can%20see%20portname%20has%20the%20IP%20address%20that%20I%20need%20to%20change.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1494668%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20change%20printer%20port%20address%20on%20windows%207%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1494668%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F661200%22%20target%3D%22_blank%22%3E%40mpd53210%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%26nbsp%3B%20powershell%20version%20are%20you%20using%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Eget-host%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EProbably%20portname%20is%20not%20supported%20in%20your%20version%3C%2FP%3E%3CP%3Etry%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%20%24a%7Cgm%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3Bto%20see%20method%20an%20properties%20of%20yout%20object%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReport%20the%20output%20here%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

I hope you and your family are safe. 

B.L.M.

 

I am running ps script to change remote pc printer driver port address. this works fine for windows 10. However if the target pc is windows 7 i get "portname" property doesn't exist . 

 

The property 'PortName' cannot be found on this object. Verify that the property exists and can be set.

 

 

any ideas?

 

3 Replies
during debugging I saw that cimproperty has the portname property. however I do not know how to read or update it.

Hello again. I have the following script. Every time I run it shows me an error.
$a=Get-Printer -ComputerName $pcname1 | Where-Object {$_.
PortName -like $OldIP} 
$a.PortName = $NewIP
Set-Printer -InputObject $a

I get this error
The property 'PortName' cannot be found on this object. Verify that the property exists and can be set
the error is on line for ($a.PortName = $NewIP)

during debug, when I hover on $a I can see properties of $a and it has two printers showing. when I drill down into it, I can see portname has the IP address that I need to change.

@mpd53210 

What  powershell version are you using?

 

get-host

 

Probably portname is not supported in your version

try

 

 $a|gm

 

 to see method an properties of yout object

 

Report the output here