« Back to Microsoft Discussions

Modify Boot Policy to service profile template

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hi all,
I need to modify my Service Profile profile Boot Policy in a Disaster Recovery Environment. Actually the Boot Policy is set to boot from local disk, when we'll test the disaster recovery, the server will boot from san.
How can i script it with powershell?
Thanks

Hi Matteo,

You can do something like this:
1Get-UcsServiceProfile -name spName | Set-UcsServiceProfile -BootPolicyName san_boot -Force
2or when you're done...
3Get-UcsServiceProfile -name spName | Set-UcsServiceProfile -BootPolicyName local_boot -Force


That's assuming you've set up a boot policy called san_boot & local_boot, you've got boot luns built, presented, zoned, etc. The -Force just prevents confirmation that you want to change the boot policy setting.

Sage

Hi,
I've resolved with the following script:


#########################
# Input Parameters #
#########################
PARAM ($Org, $SPTemp)


#######################
# Input variables here#
#######################
$ucsvip = "x.x.x.x"
$ucsadmin = "ucs_user"
$ucspsswd = "ucs_user"

#########################################
# Import the Cisco UCS PowerTool module #
#########################################
Import-Module CiscoUcsPS


############################################
# Authenticate to UCSM with the admin user #
############################################
$user = $ucsadmin
$password = $ucspsswd | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object system.Management.Automation.PSCredential($user, $password)
$handle1 = Connect-Ucs $ucsvip -Credential $cred

############################################
# Set Service Profile Template Boot Policy #
############################################


Set-UcsServiceProfile -ServiceProfile org-root/org-$Org/$SPTemp -BootPolicyName BOOT_POLICY_NAME -force


# Loop through each SP requiring acknowledgement
${lsAcks} = Get-UcsLsmaintAck -OperState "waiting-for-user" 
   
foreach (${lsAck} in ${lsAcks})
{
     # Acknowledge Maintenance Acknowlwedgement to progress reboot
     Set-UcsLsmaintAck -LsmaintAck ${lsAck} -AdminState "trigger-immediate" -force
    
     # Wait for UCS state change; reboot triggered
     ${lsAck} | Watch-Ucs -Property OperState -SuccessValue pending-next-boot -PollSec 30 -TimeoutSec 600
   
}