vmware / powershell-module-for-vmware-cloud-foundation-power-management

PowerShell Module for VMware Cloud Foundation Power Management
https://vmware.github.io/powershell-module-for-vmware-cloud-foundation-power-management/
BSD 2-Clause "Simplified" License
10 stars 8 forks source link

Add support for user prompt to select the JSON file when the management shutdown script is relaunched and SDDC Manager is already shut down #50

Open tenthirtyam opened 1 year ago

tenthirtyam commented 1 year ago

Code of Conduct

Description

Observed this message when SDDC Manager is powered off be the script and there is an issue encountered after SDDC manager is down. Here the script exit with an error message while it is trying to make a connection to an ESXi host.

[04-26-2022_08_43_45] Beginning of Log File
[04-26-2022_08:43:45] INFO Script used: C:\Users\Administrator\Desktop\shutdown and startup\shutdownandstartup\SampleScripts\PowerManagement-ManagementDomain.ps1 
[04-26-2022_08:43:45] INFO Script syntax: -server sddcmanager.rainpole.local -user [administrator@vsphere.local](mailto:administrator@vsphere.local) -pass ******* -powerState Startup
[04-26-2022_08:43:45] INFO Setting up the log file to path C:\Users\Administrator\Desktop\shutdown and startup\shutdownandstartup\SampleScripts\logs\PowerManagement-ManagementDomain.ps1-04-26-2022_08_43_45.log
[04-26-2022_08:43:46] INFO Required version of Posh-SSH found on the system
[04-26-2022_08:43:46] INFO Setting up the log file to path C:\Users\Administrator\Desktop\shutdown and startup\shutdownandstartup\SampleScripts\logs\PowerManagement-ManagementDomain.ps1-04-26-2022_08_43_45.log
[04-26-2022_08:43:46] INFO Gathering System Details from json file
[04-26-2022_08:43:46] INFO Starting run of Set-MaintenanceMode cmdlet
[04-26-2022_08:43:46] INFO Attempting to connect to server 'esx1.rainpole.local'
[04-26-2022_08:43:47]   Error at Script Line 328
[04-26-2022_08:43:47]   Relevant Command: Connect-VIServer -Server $server -Protocol https -User $user -Password $pass | Out-Null
[04-26-2022_08:43:47]   Error Message: The 'Connect-VIServer' command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.
[04-26-2022_08:43:47] INFO Finishing run of Set-MaintenanceMode cmdlet
[04-26-2022_08:43:47]   Error at Script Line 384
[04-26-2022_08:43:47]   Relevant Command: Debug-CatchWriterForPowerManagement -object $_
[04-26-2022_08:43:47]   Error Message: The 'Connect-VIServer' command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.

When script is launched again, it tries to fetch SDDC Manager though it is down.

Would you like to gracefully shutdown customer deployed Virtual Machines not managed by SDDC Manager (Yes/No)? [No]:

Have you deployed a Standalone Workspace ONE Access instance (Yes/No):

Kindly provide space separated list of Virtual Machine names for NSX-T edge nodes. (Enter for none):
 [04-26-2022_15:06:00] WARNING No Edge nodes have been provided!
 [04-26-2022_15:06:00] INFO Script used: C:\Users\Administrator\Desktop\shutdown and startup\shutdownandstartup\SampleScripts\PowerManagement-ManagementDomain.ps1
 [04-26-2022_15:06:00] INFO Script syntax: -server sddcmanager.rainpole.local -user [administrator@vsphere.local](mailto:administrator@vsphere.local) -pass ******* -powerState Shutdown
 [04-26-2022_15:06:00] INFO Setting up the log file to path C:\Users\Administrator\Desktop\shutdown and startup\shutdown
andstartup\SampleScripts\logs\PowerManagement-ManagementDomain.ps1-04-26-2022_03_06_00.log
 [04-26-2022_15:06:00] INFO Process WILL NOT gracefully shutdown customer deployed Virtual Machines not managed by VCF running if deployed within the Management Domain
 [04-26-2022_15:06:03] INFO Required version of Posh-SSH found on the system
C:\Users\Administrator\Desktop\shutdown and startup\shutdownandstartup\SampleScripts\PowerManagement-ManagementDomain.ps1 : Unable to communicate with SDDC Manager (sddcmanager.rainpole.local), check fqdn/ip address
At line:1 char:1
+ .\PowerManagement-ManagementDomain.ps1 -server "sddcmanager.rainpole. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PowerManagement-ManagementDomain.ps1

As per documentation, it is manual after that.

During shutdown of the management domain if SDDC Manager is already stopped the only option is to continue with manual steps, following VMware Cloud Foundation documentation.

Use Case(s)

Add support for user prompt to select the JSON file when the management shutdown script is relaunched and SDDC Manager is already shut down.

Potential Configuration

Would be good if it prompts user to select the JSON file like how it performs for startup.

References

No response

github-actions[bot] commented 1 year ago

'Marking this issue as stale due to inactivity. This helps us focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!'

github-actions[bot] commented 1 year ago

'Marking this issue as stale due to inactivity. This helps us focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!'

github-actions[bot] commented 10 months ago

'Marking this issue as stale due to inactivity. This helps us focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!'

burnsjared0415 commented 9 months ago

why use a json, why not just put in a option to skip the SDDC manager if it is done through a question?