Last active
May 14, 2020 19:18
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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