xcaliber0

updated

8 years ago

X

xcaliber0

1 Rookie

•

6 Posts

0

7612

February 3rd, 2019 10:00

Dell SCv3020 - Powershell remote shutdown

Attempting to script a remote shutdown of an SCv3020 running 7.3+.  I believe I need Dell EMC Storage Manager Data Collector running, load the Powershell module, and initiate the command. I checked Powershell SDK cookbook and see no mention of shutdown command.

I see this:

https://www.dell.com/community/Compellent/Shutdown-of-SCv3000-by-powershell/m-p/6108409

So command would be :

Stop-DellScController - shuts down a single controller

Stop-DellStorageCenter - shuts down an entire system

 

Are these commands correct, and if so, I would like to initiate the shutdown command with a delay of about 240 seconds.  Is this possible? 

 

 

 

  • DELL-Bob Mi

    2 Intern

    •

    230 Posts

    6685

    0

    Posted February 6th, 2019 10:00

    Once you run the shut down command it will shut the system off in less than 20 seconds. I would suggest to run this from a physical server for this reason. There is no way to run the command and have it wait for 240 seconds. 

  • DELL-Bob Mi

    2 Intern

    •

    230 Posts

    6762

    0

    Posted February 3rd, 2019 12:00

    I had previously answered this in the post you mentioned. I had scripted this in DELL STORAGE POWERSHELL API, and verified the commands. Here it shows the output of the get-help
    NAME Stop-DellStorageCenter
    SYNOPSIS Shuts down the Storage Center -Warning- This method may modify data on your system.
    SYNTAX Stop-DellStorageCenter -Instance -Connection [ ]
    ----- StorageCenterShutdown -----
    Stop-DellStorageCenter -Connection $conn -Instance $instance

    REMARKS
    To see the examples, type: "get-help Stop-DellStorageCenter -examples".
    For more information, type: "get-help Stop-DellStorageCenter -detailed".
    For technical information, type: "get-help Stop-DellStorageCenter -full".


    NAME Stop-DellScController
    SYNOPSIS Shuts down the controller -Warning- This method may modify data on your system.
    SYNTAX Stop-DellScController -Instance -Connection [ ]
    ----- ScControllerShutdown -----
    Stop-DellScController -Connection $conn -Instance $instance
    REMARKS
    To see the examples, type: "get-help Stop-DellScController -examples".
    For more information, type: "get-help Stop-DellScController -detailed".
    For technical information, type: "get-help Stop-DellScController -full".

    To pause this for 240 seconds you would need to use the start-sleep command: Start-Sleep -s 240
    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/start-sleep?view=powershell-6

    First, download and install Dell Storage Manager - 2018 R1.20 Release (Public PowerShell SDK for Dell Storage API)
    https://downloads.dell.com/FOLDER05399081M/1/DellStoragePowerShellSDK-4.2.0.7.zip
    This software is for Windows only. If you want Linux you will need to download the Public REST API version

    Then you will run the PowerShell commands to power off the system. Let me know if you have further questions.

  • xcaliber0

    1 Rookie

    •

    6 Posts

    6737

    0

    Posted February 4th, 2019 15:00

    Bob,

    This is great thanks.  Is it possible to pipe the Sleep command into the SCv3020?  So send the command with Sleep.  This way I can run it from a virtual machine and then initiate the final VM shutdown after sending the delayed shutdown to the SC.  Let me know thanks.

     

    -David

  • DELL-Bob Mi

    2 Intern

    •

    230 Posts

    6731

    0

    Posted February 4th, 2019 16:00

    A very simple script to perform this shut down.
    Import-Module "{Install Path}\DellStorage.ApiCommandSet.psd1 # you need to import the module every time the script is run
    $user = "Admin"                   # user name for data collector
    $em = "172.18.144.18"        # IP for data collector
    $pass = ConvertTo-SecureString "Compellent04" -AsPlainText -Force                  #password for data collector
    $conn = Connect-DellApiConnection -HostName $em -User $user -password $pass #connection to SC
    $chassis = 61038                 #SSN of system
    Start-Sleep -s 240                #sleep command for 240 seconds
    Stop-DellStorageCenter -Instance $chassis -Connection $conn -Confirm:$false #shuts down BOTH controllers

    OR, you can put the start-sleep command after the stop command.
    Please make certain that by running this from a Virtual Machine that the VM does not crash when the storage center is shut down.
    Please note: Each script will have to be customized, and its required functionality should be well understood and tested prior to deploying in a production environment.

    You could use an output to show the start-sleep count down as per:
    https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/17/writing-output-with-powershell/

    https://www.itdroplets.com/update-write-host-output-powershell/

    https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Write-Progress?view=powershell-5.1

  • xcaliber0

    1 Rookie

    •

    6 Posts

    6691

    0

    Posted February 6th, 2019 07:00

    Bob,


    Thanks!  I have the Data Collector installed and configured, the Dell API powershell command set loaded and am able to connect to the DC and send commands.

    You indicated :

    Please make certain that by running this from a Virtual Machine that the VM does not crash when the storage center is shut down.

    This is why I need the delay. The problem is that I don't want to run the Data Collector from a physical Host - it has memory / resource overhead.  Can I pipe the Start-Sleep command, or send a function/script to run to the DC?  Basically - I want to send the command from the Virtual Machine - Stop-DellStorageCenter, then complete the Virtual Machine, and cluster shutdown prior to the SCv3020 initiating its shutdown on delay.  Is this possible?  Thanks!

  • xcaliber0

    1 Rookie

    •

    6 Posts

    6683

    0

    Posted February 6th, 2019 12:00

    Bob,

    I will move this 1 VM to local storage then, so it is not reliant on the SAN to stay up.  I think this is all I need to get the auto-shutdown working.  Would be great to have a feature request for a delay with that stop command.  Thank you!

  • xcaliber0

    1 Rookie

    •

    6 Posts

    6650

    0

    Posted February 7th, 2019 07:00

    Bob,

    One more question :

     

    Stop-DellStorageCenter -Instance $chassis -Connection $conn -Confirm:$false #shuts down BOTH controllers

    Does the -Confirm:$false send the command to confirm, but does not actually initiate it?  Thanks!

     

  • DELL-Bob Mi

    2 Intern

    •

    230 Posts

    6644

    0

    Posted February 7th, 2019 08:00

    If you do not include the -Confirm option the script will create a pop-up (when using PowerShell ISE) and wait for you to confirm that you want to shut down the controller.

    PS C:\Users\Administrator> $ssn = "62285"

    PS C:\Users\Administrator> Stop-DellScController -Instance $ssn -Connection $conn

    2019-02-07_10-43-50.png

    By using the -Confirm:$False you are telling PowerShell to not ask for confirmation.