Microsoft Virtualization Discussions

connect-nccontroller without password prompt


Hi together,


I'm trying to run a script (exporting shares etc.) without a password promt.


Our CVO 9.5P10 is domain joined and the user the powershell session is running with is set as admin on clust and svm level.

Is there a way to use the user of the Powershell session to do the login without storing the password somewhere and without having a password prompt?


I tried multiple things, e.g.

connect-nccontroller $server

connect-nccontroller $server -Credential $(whoami)




Check the man pages.. Here is the full information


C:\PS>$password = ConvertTo-SecureString "p@ssword" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "admin",$password
Connect-NcController -Credential $cred

Connect to controller '' using HTTP/HTTPS but suppress the credential prompt by creating a PSCredential object programmatically.



Yes, I read this. But this means I have to store the password one time. And I have to change this when the domain password changes.

Is there no way to use the token of the already logged in user?


Someone shared this on another post of mine.  You can pass this for the credentials.


#Store credentials if needed
if (!($Creds)){Set-Variable -Name Creds -Value (Get-Credential -credential "$env:userdomain\$env:username") -Scope Global -Visibility Public -Option AllScope}



My recommendation would be to look at the "Add-NcCredential" cmdlet for encrypted storage of cached credentials that can be used by the PSTK. You could also use the "Credential Manager" module from the PowerShell Gallery, which provides you a method to retrieve credentials from the native Windows Credential Manager. I've used both of these options with good results in my code.