-
-
Save Niqq787/622e6b63c05eb3bc1e0e97c76f4c8596 to your computer and use it in GitHub Desktop.
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
Function Get-Device() { | |
param( | |
[parameter (mandatory=$true)][string] $InstanceId | |
) | |
$CurrentDevice = Get-EC2InstanceAttribute $InstanceId -Attribute blockDeviceMapping | Select-Object -ExpandProperty BlockDeviceMappings | Select-Object -last 1 | |
If ($CurrentDevice.DeviceName -eq '/dev/sda1') { | |
$NewDevice = 'xvdf' | |
return $NewDevice | |
} | |
Else { | |
$a = $CurrentDevice.DeviceName.ToCharArray() | |
$inc = +1 | |
$a[3] = [char]([int]($a[3])+$inc) | |
$NewDevice = -join $a | |
return $NewDevice | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment