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
Can't connect to array with PowerShell ?
-
- Posts: 7
- Joined: Tue Apr 22, 2014 12:20 pm
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
}
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
}
-
- Posts: 7
- Joined: Tue Apr 22, 2014 12:20 pm
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.