UNSOLVED

s33butler

updated

14 years ago

S

s33butler

12 Posts

0

81166

February 13th, 2013 12:00

Powershell & Enterprise Manager

I have several controllers and it would be nice if I could run the commands through my Compellent Enterprise Manager.  I was unable to find anything in the documentation, is that possible or am I doing something wrong?

PS C:\Scripts> Get-SCConnection -HostName EntMgr -User Admin -Password $pass
Get-SCConnection : Connection failed
At line:1 char:17
+ Get-SCConnection <<<< -HostName EntMgr -User Admin -Password $pass
+ CategoryInfo : OpenError: (EntMgr:String) [Get-SCConnection], Exception
+ FullyQualifiedErrorId : ConnectionFailure,SCCommandSet.Commands.SCConnectionGet
 
Or does these commandlets only work with the Storage Center interfaces?
 
Thank you for your time and assistance,
Scott
  • Kathy_H

    11 Posts

    2000

    0

    Posted April 5th, 2013 08:00

    Did you eventually get an answer to this question or figure out the issue?

    Am using Powershell with Compellent for the first time too and having the same problems with connection... might be worth mentioning am connecting as a "reporter" user.

    Many Thanks.

    Kathy

  • 2000

    0

    Posted April 7th, 2013 17:00

    Hello Scott, and Kathy,

    It is not possible to run commands through the Enterprise Manager using PowerShell or the Storage Center Command Set. What specifically are you trying to do through Enterprise Manager?

    Kathy, What kind of errors are you seeing when trying to log in using a "reporter" user?

  • Kathy_H

    11 Posts

    2000

    0

    Posted April 15th, 2013 03:00

    I guess it's worth mentioning, I only have reporter rights, but I would have thought this would still allow me to run reports and the get-sc* commands.

  • Kathy_H

    11 Posts

    2000

    0

    Posted April 15th, 2013 03:00

    Hi CompellentSanAdmin,

    Thanks for your response.  I was looking to use Powershell to run reports really, making use of the get-sc* commands mostly.  

    However, I am yet to establish how to connect to the SAN?  I ran the command:

    Get-SCConnection -HostName $scname -User $scuser -Password $scpassword

    (the variable for the hostname was the ip address of the Enterprise Mngmnt Svr)

    but am met with the error message:

    Get-SCConnection : Connection failed

    At C:\Scripts\Compellent-GetSCConnection.ps1:5 char:1

    + Get-SCConnection -HostName $scname -User $scuser -Password $scpassword #-Default

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo          : OpenError: (172.16.100.18:String) [Get-SCConnection], Exception

       + FullyQualifiedErrorId : ConnectionFailure,SCCommandSet.Commands.SCConnectionGet

    I load the snap-in successfully however.

    So I guess the question is, should the host name be the Enterprise Management Server or something else?

    Kind Regards - Kathy.

  • 2000

    0

    Posted April 19th, 2013 08:00

    Kaff_H,

    Once you invoke the PowerShell command prompt, here is an example of a script that I use to connect to my array(s) and run whatever PowerShell SC commands:

    $user = Read-Host -Prompt "Please enter username"

    $pass = Read-Host -AsSecureString -Prompt "Please enter password"

    Write-Host ""

    Write-Host ""

    Get-SCConnection -HostName compellent01.domain.net -User $user -Password $pass -Save compellent01

    Get-SCConnection -HostName compellent02.domain.net -User $user -Password $pass -Save compellent02

    Get-SCConnection -HostName compellent03.domain.net -User $user -Password $pass -Save compellent03

    Write-Host ""

    Write-Host "Press any key to continue..." -foregroundcolor "yellow"

    $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

    Once that script completes, you will be connected to any/all of the arrays that you specify in the Get-Connection lines above (add as many as you need).  Next, you will need to specify the connection that you want to run the command(s) against by invoking something like:

    Get-SCConnection -Name compellent01 -Default -DestinationDefault

    Then run whatever get-sc* command you want and it will run against the compellent01.domain.net array until you specify another one.

  • Kathy_H

    11 Posts

    2000

    0

    Posted April 19th, 2013 09:00

    @DellLarryBoy

    Thanks so much for your response.

    I just managed to find an article this morning online showing a script with the "-save" switch in it.  Realised that I had to use the IP address of the controller also, not enterprise manager, and eventually got connected!!

    Your script  is perfect though and would have helped me heaps!

    I am not sure though how the $X variable is of use??  Confused me a little.

    Very much appreciated.

    Kath

  • 2000

    0

    Posted April 19th, 2013 10:00

    BTW, if you are not already using the Storage Center Command Set 7.x, I highly recommend that you download it from the KC and start using it.  It adds several new commands that I have found to be very useful.

  • 2000

    0

    Posted April 19th, 2013 10:00

    FYI...

    $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

    In this line we’re using PowerShell’s automatic variable $host (which is actually an instance of the .NET Framework class System.Management.Automation.Host) and the ReadKey method. (Which is actually a method of the RawUI property, which is a property of the UI property, which is a property of $host. And the leg bone’s connected to the knee bone, the knee bone’s connected to the ankle bone, the ….) The ReadKey method enables us to get information about the key that has just been pressed. Of course, in this case the only information we care about is the fact that a key has been pressed. Therefore, we pass ReadKey two parameters:

    NoEcho. This prevents any information from appearing on screen when the user presses a key. If you leave out this parameter the pressed key will be echoed back to the screen.

    IncludeKeyDown. This tells the script to continue as soon as a key has been pressed; that means the script will continue even if the user presses and holds a key down. If you’d prefer to wait until the user has released the key, then use this parameter instead: IncludeKeyUp.

    This information is taken from the following article:  technet.microsoft.com/.../ff730938.aspx

    Let me know if you have any other questions.

  • Kathy_H

    11 Posts

    2000

    0

    Posted April 22nd, 2013 05:00

    The Compellent.StorageCenter.PSSnapin.dll says 6.1.0.3 when I look at the Properties - Details Tab.   I guess I don't have the latest version then?

  • 268

    0

    Posted May 1st, 2013 18:00

    As you know the # sign is used to comment out lines of scripts. By default the sample script has an extra # sign in this line:

    $connection = Get-SCConnection -HostName $schost -User $user -Password $pass #-Save $schost -Default

    You will need to remove this in order to get the script to work properly.

    run the command Get-SCCommandSetVersion to see what version you have.