Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
I am wondering if there's a way to get connected nfs clients per volume using powershell.
I see a cmdlet for:
Get-NcCifsConnection
Get-NcIscsiConnection
But nothing for NFS.
If not, how do I request for feature enhancement for it?
Solved! See The Solution
Nothing for PowerShell currently, but we do have REST API support for that command.
You can find the REST docs and sample commands via: https://clustermgmt-ip/docs/api
You can also generate sample commands in that view. It creates a curl command, as well as a website URL that generates XML output. This is what it would look like:
Nothing for PowerShell currently, but we do have REST API support for that command.
You can find the REST docs and sample commands via: https://clustermgmt-ip/docs/api
You can also generate sample commands in that view. It creates a curl command, as well as a website URL that generates XML output. This is what it would look like:
Thanks @parisi I'll use that instead. But it still would be good if nfs connection can be added to the cmdlet.
To add to this, since powershell doesn't really do curl or wget anymore, you can use "invoke-restmethod:"
https://wilsonmar.github.io/powershell-rest-api/
Here’s how I got it to work in PS version4:
PS C:\Users\Administrator> $pwd = ConvertTo-SecureString "password" -AsPlainText -Force
PS C:\Users\Administrator> $cred = New-Object Management.Automation.PSCredential ('admin', $pwd)
PS C:\Users\Administrator> Invoke-RestMethod -method get -uri "http://10.193.67.10/api/protocols/nfs/connected-clients?svm.name=DEMO&return_timeout=15&return_records=true" -cred $cred
records
-------
{@{svm=; node=; server_ip=10.193.67.219; client_ip=10.63.150.51; volume=; protocol=nfs3; _links=}, @{svm=; node=; server_ip=10.193.67.219; client_ip=10.63.150.51; volume=; protocol=nfs3; _links=},...
Powershell 6 and later adds -Authentication, which makes the cred part easier.