Skip to content

Instantly share code, notes, and snippets.

@mccbryan3
Last active May 14, 2020 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mccbryan3/ca594126f069dff47d916849825c6314 to your computer and use it in GitHub Desktop.
Save mccbryan3/ca594126f069dff47d916849825c6314 to your computer and use it in GitHub Desktop.
Take the SVC unformatted output for host to vdisk and use a name,capacity,FC_id vdisk list in anothe file to build the report.
$basepath = 'C:\Storage-Migration'
$content = gc "$basepath\mc\mcsvc01vdisks.txt"
gc "$basepath\mc\mcsvc01vdisksbyhost.txt" | %{
$line = $_
if($line -match "^\d+") {
$match = [regex]::Matches($line, "\S*(?>\s+)")
$vol_match = $content | sls -Pattern $(($match[4].value).Trim())
try{
if($match) {
$vol_size = [regex]::Match($vol_match,'(?<=,)[\w\.\w]+(?=,[m\d])')
$hash = @{
vol_id = $match[0].Value.Trim()
host_id = $match[1].Value.Trim()
scsi_id = $match[2].Value.Trim()
vdisk_id = $match[3].Value.Trim()
vdisk_name = $match[4].Value.Trim()
vdisk_uuid = $match[5].Value.Trim()
vol_size = $vol_size
}
New-Object -TypeName psobject -Property $hash
}
} catch {"Error! - Line: $line`tSize: $vol_size"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment