Hi, All.
Would anyone happen to know how to filter out blank values after a query? For example if I run:
Get-Printer -ComputerName PrintServer1 | where {$_.Name -match “GYY54-East”} | select *
I get the following values:
RenderingMode :
PrinterStatus : Normal
Type : Local
DeviceType : Print
Caption :
Description :
ElementName :
InstanceID :
CommunicationStatus :
DetailedStatus :
HealthState :
InstallDate :
Name : GYY54-East
OperatingStatus :
OperationalStatus :
PrimaryStatus :
Status :
StatusDescriptions :
BranchOfficeOfflineLogSizeMB :
Comment : Test Printer - 565 N. Hetfield Way Chicago, IL
ComputerName : printserver1
Datatype : RAW
DefaultJobPriority : 0
DisableBranchOfficeLogging :
DriverName : Universal v2
JobCount : 0
KeepPrintedJobs : False
Location : Chicago/U.S.A
PermissionSDDL :
PortName : IP_192.168.0.121
PrintProcessor : RIUD3P4C
Priority : 1
Published : True
SeparatorPageFile :
Shared : True
ShareName : GYY54-East
StartTime : 60
UntilTime : 60
WorkflowPolicy :
PSComputerName :
CimClass : ROOT/StandardCimv2:MSFT_Printer
CimInstanceProperties : {Caption, Description, ElementName, InstanceID…}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
Is there a way to filter out the properties that have no values to them? I tried a simple ForEach to go through each property and not include it in the final output if the value is blank. But that didn’t go very well. I’ve never had to run through something like this, so I’m not sure where to begin.
Any help would be fabulous.
Thanks in advance.