Ok I know there are other ways to do this... but this is the way I'm trying to do it.. so close, yet so far.
Code:
$strComputer = "."
$objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2")
$objPrinter = 'objWMIService.Get("Win32_Printer").SpawnInstance'
$objPrinter.DriverName = "HP Color LaserJet 4550 PCL 6"
$objPrinter.PortName = "IP_127.0.0.1"
$objPrinter.DeviceID = "ScriptedPrinter"
$objPrinter.Location = "Net Admin"
$objPrinter.Network = "True"
$objPrinter.Shared = "True"
$objPrinter.ShareName = "ScriptedPrinter"
$objPrinter.Put



Everything seems to work fine up until $objPrinter.Put, which returns an error 6 "The handle is invalid.".

What am I doing wrong?