<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#! /usr/bin/env perl

use warnings;
use strict;

my $runDirectory = 'C:/Program Files (x86)/Online Diagnostics/oldiags/bin/';
my $command = 'pediags.exe sasdevdiag --show device';

chdir ( $runDirectory );
my $output = `$command`;

my @output = split( /[\r\n]/, $output );

#print $output;

my $currentDevice;
my $currentStatus;

my %outputInformation;


for ( my $i = 0; $i &lt; @output; $i++ ) {
	next if $output[$i] =~ m/^\s*$/;
	my ( $tag,$value ) = split( ' : ', $output[$i] );
	$tag =~ s/\s+$//;
	$value =~ s/^\s+//;
	#print "[$tag]\n"; print "$value\n"; die;
	if ( $tag eq 'Device Index' ) {
		$currentDevice = $value;
		#print "CurrentDevice is $currentDevice\n";
	} else {
		$outputInformation{$currentDevice}{$tag} = $value;
	}
}


foreach my $device ( sort keys %outputInformation ) {
	if ( $outputInformation{$device}{'Device Class'} eq 'RAID Array Disk' )  {
		if ( $outputInformation{$device}{'Device Status'} eq 'Device is working properly.' ) {
			print "Device $device [$outputInformation{$device}{'Device Name'}] is working properly\n";
		}
	}
}
&lt;&gt;;

#foreach my $device ( sort keys %outputInformation ) {
#	print "Device $device\n";
#	my $temp = $outputInformation{$device};
#	foreach my $tag ( sort keys %$temp ) {
#		print "\t$tag\t$temp-&gt;{$tag}\n";
#	}
#}

1;
</pre></body></html>