Here it is:
$PrinterSettingsPolicySettings | gm
TypeName: PrinterSettings
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Action Property string Action {get;set;}
bypassErrors Property string bypassErrors {get;set;}
Comment Property string Comment {get;set;}
Default Property string Default {get;set;}
DeleteAll Property string DeleteAll {get;set;}
doubleSpool Property string doubleSpool {get;set;}
Filters Property string Filters {get;set;}
GpoSettingOrder Property string GpoSettingOrder {get;set;}
ipAddress Property string ipAddress {get;set;}
LocalName Property string LocalName {get;set;}
Location Property string Location {get;set;}
lprQueue Property string lprQueue {get;set;}
Name Property string Name {get;set;}
Path Property string Path {get;set;}
Policy Property string Policy {get;set;}
PolicyType Property string PolicyType {get;set;}
portNumber Property string portNumber {get;set;}
Protocol Property string Protocol {get;set;}
Section Property string Section {get;set;}
SkipLocal Property string SkipLocal {get;set;}
snmpCommunity Property string snmpCommunity {get;set;}
snmpDevIndex Property string snmpDevIndex {get;set;}
snmpEnabled Property string snmpEnabled {get;set;}
Status Property string Status {get;set;}
UseDNS Property string UseDNS {get;set;}
UseIpV6 Property string UseIpV6 {get;set;}
When I export the variable using Export-Csv the csv file contains this:
"Policy","Section","PolicyType","Name","Status","bypassErrors","GpoSettingOrder","Filters","lprQueue","snmpCommunity","Protocol","portNumber","doubleSpool","snmpEnabled","snmpDevIndex","ipAddress","Action","Location","LocalName","Comment","Default","SkipLocal","UseDNS","UseIpV6","Path","DeleteAll"
"CPLP_PG_Lab_Printer","Computer","PrintersSettings","PGP110","PGP110","1","1","","","","PROTOCOL_RAWTCP_TYPE","9100","0","0","1","PGP110","U","","PGP110","","0","0","1","0","\\PRINTSERVER\PGP110","0"
The Excel file contains only “PrinterSettings” which is the custom class created in the function:
"PrintersSettings" {
Write-Host "Found a PrinterSettings in Computer section in $($GpoDetail.Name)." -ForegroundColor Green
foreach ($Printer in $compext.Printers.PortPrinter) {
$PrinterSettingsPolicySettings.Add($(Get-PrinterSetting -Value $Printer))
}
The “Get-PrinterSetting” function works and returns the results you see in the Csv file.