Skip to content

Instantly share code, notes, and snippets.

@Mierdin
Last active March 2, 2016 19:24
Show Gist options
  • Save Mierdin/5779629 to your computer and use it in GitHub Desktop.
Save Mierdin/5779629 to your computer and use it in GitHub Desktop.
Very brief and informal PowerShell script to configure a Boot-From-SAN policy and attach it to the relevant service profile templates.
# InstallBFS.ps1
#
# Very brief and informal PowerShell script to configure a Boot-From-SAN policy and attach it to the relevant service profile templates.
Import-Module CiscoUcsPs
Disconnect-Ucs
Connect-Ucs 10.0.0.1
$organization = "SUBORG_01"
#Add Boot Policies
$bp = Add-UcsBootPolicy -Org $organization -Name "BFS-ESX-PROD" -EnforceVnicName yes
$bp | Add-UcsLsBootVirtualMedia -Access "read-only" -Order "1"
$bootstorage = $bp | Add-UcsLsbootStorage -ModifyPresent -Order "2"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "primary" -VnicName "ESX-PROD-A"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "secondary" -VnicName "ESX-PROD-B"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bp = Add-UcsBootPolicy -Org $organization -Name "BFS-ESX-NONP" -EnforceVnicName yes
$bp | Add-UcsLsBootVirtualMedia -Access "read-only" -Order "1"
$bootstorage = $bp | Add-UcsLsbootStorage -ModifyPresent -Order "2"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "primary" -VnicName "ESX-NONP-A"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "secondary" -VnicName "ESX-NONP-B"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bp = Add-UcsBootPolicy -Org $organization -Name "BFS-WIN-PROD" -EnforceVnicName yes
$bp | Add-UcsLsBootVirtualMedia -Access "read-only" -Order "1"
$bootstorage = $bp | Add-UcsLsbootStorage -ModifyPresent -Order "2"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "primary" -VnicName "BARE-PROD-A"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "secondary" -VnicName "BARE-PROD-B"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bp = Add-UcsBootPolicy -Org $organization -Name "BFS-WIN-NONP" -EnforceVnicName yes
$bp | Add-UcsLsBootVirtualMedia -Access "read-only" -Order "1"
$bootstorage = $bp | Add-UcsLsbootStorage -ModifyPresent -Order "2"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "primary" -VnicName "BARE-NONP-A"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage = $bootstorage | Add-UcsLsbootSanImage -Type "secondary" -VnicName "BARE-NONP-B"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "primary" -Wwn "50:00:00:00:00:00:00:00"
$bootsanimage | Add-UcsLsbootSanImagePath -Lun 0 -Type "secondary" -Wwn "50:00:00:00:00:00:00:00"
Get-UcsServiceProfile -Name "SPT-ESX-PROD" | Set-UcsServiceProfile -BootPolicyName "BFS-ESX-PROD" -force
Get-UcsServiceProfile -Name "SPT-ESX-NONP" | Set-UcsServiceProfile -BootPolicyName "BFS-ESX-NONP" -force
Get-UcsServiceProfile -Name "SPT-WIN-PROD" | Set-UcsServiceProfile -BootPolicyName "BFS-WIN-PROD" -force
Get-UcsServiceProfile -Name "SPT-WIN-NONP" | Set-UcsServiceProfile -BootPolicyName "BFS-WIN-NONP" -force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment