modifying object properties

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Sam Boutros Sam Boutros 2 years, 4 months ago.

  • Author
    Posts
  • #17494
    Profile photo of Garegin Asatryan
    Garegin Asatryan
    Participant

    I have a weird question. Can you modify object properties. the command

    Get-PrinterPort 192.* | fl *

    prints out all the attributes of the printer port. but I can't modify them. I don't want to create a new port and start from scratch, just modify the existing object. Or maybe export the export and then import it, modified, into the new one.

  • #17496
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Well, normally you can, but this appears to be an exception to the rule. Get-PrinterPort returns a CIM object of type MSFT_PrinterPort (or one of a number of subtypes). I've tried several methods of modifying these ports through WMI (including through the older Win32_TCPIPPrinterPort class), and none of them seem to work. What's odd is that you can modify the properties of printer ports through the GUI (which means it's possible via the Win32 API, most likely). Not sure why they chose to leave that functionality out of the WMI classes.

    Which property are you trying to modify?

  • #17497
    Profile photo of Garegin Asatryan
    Garegin Asatryan
    Participant

    [blockquote]Which property are you trying to modify?[/blockquote]

    the ip address and the name

  • #17504
    Profile photo of Sam Boutros
    Sam Boutros
    Participant

    try this script [url]http://superwidgets.wordpress.com/2014/07/27/powershell-script-to-change-printer-ip-address/[/url]

You must be logged in to reply to this topic.