Start a Conversation

Unsolved

This post is more than 5 years old

891

June 28th, 2016 13:00

Please help - Data collection script for powershell

Hi everyone.
I'm a beginner with Data domains and power shell.
I do have some linux experience but it's only come in handy somewhat while scripting in power shell.

I've been tasked with creating a power shell script that will access data domains via ssh and collect the data from them.

Unfortunately this script is a commitment and other methods such as DDMC, won't suffice.
With that in mind, I was interested if anyone could help me solve a few issues.

I recently took a script from the following site:Once upon a day.. : Using Powershell to check Data Domains
and modified it for my organization's needs.

Within the script is a $includelist variable that request the post-comp.

>

$includeList="Cleanable GiB|--------|/data: post-comp" #Data domain format command to print

  $DB = Get-Content $answerfile #inputstream from file

>

The data is then collected in the foreach loop, with

>

$command = "/C $plinkcommand $user@$Data -pw ""$passwd"" df" #ssh command

  $Data #Unknown reason for data here, might be part of the df command, but otherwise may be used to
>

and outputted to the log file with:
>

$outputcontents = &$exe $command ##ssh connect execution + "df" command

if ($outputcontents -ne "") #if SSH is not null
{

                

$outputcontents | ForEach-Object { #foreach requires bracket on same line
if ($_ -match $includeList) { WriteLog $_ }  #run data collection

                        #add commands here and write log them   

                        }

}

>

With this, i've found the ability to pull data from post-comp, pre-comp and ddvar.
I however, would like to pull data from the following commands;
     System     -show all

                    -show modelno

                    -show hardware

                    -show compression

                    -show stats

     Filesys     -show space 


Does anyone know how I would go about collecting this data with this format? or is a completely different approach more appropriate.


Thank you to anyone who tries or tried to help me. I appreciate your effort.

No Responses!
No Events found!

Top