Public/New-specPrinterObject.ps1
function New-specPrinterObject { <# .SYNOPSIS Returns an instance of the Printer object. .DESCRIPTION This function creates and returns an instance of the Printer class, allowing users to manage printer drivers, ports, and printers through object-oriented methods. .PARAMETER Name The name of the printer. .PARAMETER Driver The name of the driver associated with the printer. .PARAMETER PortName The name of the port associated with the printer. .PARAMETER PrinterHostAddress The host address of the printer for port configuration. .EXAMPLE $printer = Get-specPrinterObject -Name 'OfficePrinter' -Driver 'HP LaserJet' -PortName 'OfficePort' -PrinterHostAddress '192.168.1.10' $printer.AddPrinter() .NOTES Author: owen.heaume Version: 1.0 - Initial release #> param ( [parameter(Mandatory = $true)] [string]$Name, [parameter(Mandatory = $true)] [string]$Driver, [parameter(Mandatory = $true)] [string]$PortName, [parameter(Mandatory = $true)] [string]$PrinterHostAddress ) # Create and return an instance of the Printer class return [Printer]::new($Name, $Driver, $PortName, $PrinterHostAddress) } |