![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Creating new Printer-Port and installing new Printer Hello i found following WSH-Skript at die MSDN-Website. But how can i do this with the powershell? I do not know how to create a new instance of the Win32_TCPIPPrinterPort-Class. thanks Jens strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objNewPort = objWMIService.Get _ ("Win32_TCPIPPrinterPort").SpawnInstance_ objNewPort.Name = "IP_169.254.110.14" objNewPort.Protocol = 1 objNewPort.HostAddress = "169.254.110.14" objNewPort.PortNumber = "9999" objNewPort.SNMPEnabled = False objNewPort.Put_ |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Creating new Printer-Port and installing new Printer this is RC1 code as I have no RC2 handy (for more info about the changes see my blog series http://mow001.blogspot.com/2006/10/p...t-in-rc2.html: # RC2 $p = [WmiClass]'Win32_TCPIPPrinterPort' $p = new-object management.managementclass Win32_TCPIPPrinterPort $NewPort = $p.CreateInstance() $NewPort.Item('Name') = "IP_169.254.110.14" #... $NewPort.Put() Greetings /\/\o\/\/ "Jens Schulze" wrote: > Hello > i found following WSH-Skript at die MSDN-Website. But how can i do this with > the powershell? I do not know how to create a new instance of the > Win32_TCPIPPrinterPort-Class. > > thanks Jens > > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > Set objNewPort = objWMIService.Get _ > ("Win32_TCPIPPrinterPort").SpawnInstance_ > > objNewPort.Name = "IP_169.254.110.14" > objNewPort.Protocol = 1 > objNewPort.HostAddress = "169.254.110.14" > objNewPort.PortNumber = "9999" > objNewPort.SNMPEnabled = False > objNewPort.Put_ > > > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Creating new Printer-Port and installing new Printer Thank you, i will test it :-) "/\/\o\/\/ [MVP]" <oMVP@discussions.microsoft.com> schrieb im Newsbeitrag news:400366BF-8408-4D30-A5CD-99D71724DA15@microsoft.com... > this is RC1 code as I have no RC2 handy (for more info about the changes > see > my blog series > http://mow001.blogspot.com/2006/10/p...t-in-rc2.html: > > > # RC2 $p = [WmiClass]'Win32_TCPIPPrinterPort' > $p = new-object management.managementclass Win32_TCPIPPrinterPort > > $NewPort = $p.CreateInstance() > $NewPort.Item('Name') = "IP_169.254.110.14" > #... > > $NewPort.Put() > > > Greetings /\/\o\/\/ > > > "Jens Schulze" wrote: > >> Hello >> i found following WSH-Skript at die MSDN-Website. But how can i do this >> with >> the powershell? I do not know how to create a new instance of the >> Win32_TCPIPPrinterPort-Class. >> >> thanks Jens >> >> strComputer = "." >> Set objWMIService = GetObject("winmgmts:" _ >> & "{impersonationLevel=impersonate}!\\" & strComputer & >> "\root\cimv2") >> Set objNewPort = objWMIService.Get _ >> ("Win32_TCPIPPrinterPort").SpawnInstance_ >> >> objNewPort.Name = "IP_169.254.110.14" >> objNewPort.Protocol = 1 >> objNewPort.HostAddress = "169.254.110.14" >> objNewPort.PortNumber = "9999" >> objNewPort.SNMPEnabled = False >> objNewPort.Put_ >> >> >> >> |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Creating new Printer-Port and installing new Printer Thank you, works fine :-) "Jens Schulze" <webmaster@irgendwas.de> schrieb im Newsbeitrag news:%23asrfrT7GHA.4348@TK2MSFTNGP03.phx.gbl... > Thank you, > > i will test it :-) > > > "/\/\o\/\/ [MVP]" <oMVP@discussions.microsoft.com> schrieb im Newsbeitrag > news:400366BF-8408-4D30-A5CD-99D71724DA15@microsoft.com... >> this is RC1 code as I have no RC2 handy (for more info about the changes >> see >> my blog series >> http://mow001.blogspot.com/2006/10/p...t-in-rc2.html: >> >> >> # RC2 $p = [WmiClass]'Win32_TCPIPPrinterPort' >> $p = new-object management.managementclass Win32_TCPIPPrinterPort >> >> $NewPort = $p.CreateInstance() >> $NewPort.Item('Name') = "IP_169.254.110.14" >> #... >> >> $NewPort.Put() >> >> >> Greetings /\/\o\/\/ >> >> >> "Jens Schulze" wrote: >> >>> Hello >>> i found following WSH-Skript at die MSDN-Website. But how can i do this >>> with >>> the powershell? I do not know how to create a new instance of the >>> Win32_TCPIPPrinterPort-Class. >>> >>> thanks Jens >>> >>> strComputer = "." >>> Set objWMIService = GetObject("winmgmts:" _ >>> & "{impersonationLevel=impersonate}!\\" & strComputer & >>> "\root\cimv2") >>> Set objNewPort = objWMIService.Get _ >>> ("Win32_TCPIPPrinterPort").SpawnInstance_ >>> >>> objNewPort.Name = "IP_169.254.110.14" >>> objNewPort.Protocol = 1 >>> objNewPort.HostAddress = "169.254.110.14" >>> objNewPort.PortNumber = "9999" >>> objNewPort.SNMPEnabled = False >>> objNewPort.Put_ >>> >>> >>> >>> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Problem with printer port | Vista print fax & scan | |||
| printer port | Vista print fax & scan | |||
| Local Printer Port | Vista General | |||
| Cannot add printer if creating local port | Vista print fax & scan | |||
| Virtual Printer Port for USB | Vista hardware & devices | |||