Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All,
I'm somewhat new to powershell and the DataOntap module. Could
someone provide some guidance on trapping errors on Connect-NaController. Basically
if there is an authentication or communication issue I was to write out a
cleaner error to the screen and prompt the user to re-enter their information.
import-module C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DataONTAP
$user = Read-Host "Enter Netapp User ID"
$password = (Read-Host -assecurestring "Enter Netapp Password")
$Netapp_IP = Read-Host "Enter Netapp IP Address"
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password
$NaController = (Connect-NaController $Netapp_IP -Credential $cred)
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Paul. Try something along these lines:
$NaController = Connect-NaController dunn -Credential root -ErrorAction SilentlyContinue
if ($NaController -eq $null) { Write-Host $Error[0].Exception.Message }
