HPE Storage Users Group
https://3parug.net/

Can't connect to array with PowerShell ?
https://3parug.net/viewtopic.php?f=17&t=1812
Page 1 of 1

Author:  Hondaman88 [ Tue Dec 08, 2015 5:28 pm ]
Post subject:  Can't connect to array with PowerShell ?

Hi
I am new to 3 Par. I downloaded the 3 Par PowerShell Toolkit. version 2.0

But I can't get the new-sanconnection command to work... it says cmdlet not found.

I can't get the new-sshconnection command to work either.. it says access denied.

The documentation is kind of sketchy.

Does anyone have a quick example of the best way to connect to the array with Powershell?

Thanks

Author:  johnbecker31 [ Fri Feb 12, 2016 12:31 pm ]
Post subject:  Re: Can't connect to array with PowerShell ?

Here are the basics. you will need plink, and also need to generate ssh keys with puttygen or something. have fun!

function plink
{
[CmdletBinding()]
PARAM
(
[Parameter(Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[string] $remoteHost,

[Parameter(Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[string] $ppk,

[Parameter(Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[string] $command)

& .\plink.exe $remoteHost -i $ppk $command
return
}

$logfile = "logfile.txt"
$remoteHost = "[user]@[array]"
$ppk = "[private_key].ppk"

$command1 = "removevlun -f [volume_name] [LUN_ID] [Host or Set]"
$command2 = "updatevv -ro -f [volume_name]"
$command3 = "createvlun -f [volume_name] [LUN_ID] [Host or Set]"

try
{
plink $remoteHost $ppk $command1
}
catch
{
"Error: $($_.Exception.Message)" >> $logfile
[send an email or something]
break
}

try
{
plink $remoteHost $ppk $command2
}
catch
{
"Error: $($_.Exception.Message)" >> $logfile
[send an email or something]
break
}

try
{
plink $remoteHost $ppk $command3
}
catch
{
"Error: $($_.Exception.Message)" >> $logfile
[send an email or something]
break
}

Author:  johnbecker31 [ Fri Feb 12, 2016 12:38 pm ]
Post subject:  Re: Can't connect to array with PowerShell ?

Also, you need to make sure that you set up a user on the array, set the acl's for that user, and set the public ssh key for that user.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/