Microsoft Virtualization Discussions

SNMPv3 with PowerShell Toolkit

mrblack
4,220 Views

Hi Guys,

 

ONTAP Version 9.1PX

 

I'm attempting to create a general config script I can apply to new clusters once they hit the floor. One of these steps is to create a SNMPv3 account. From what I can find the only cmdlet we have right now is "new-ncuser". But it seems to lack all the arguments / variables to create an SNMPv3 account. I've written the below invoke-ncssh command. I know the below invoke command won't work do to multiple things, but I just wanted to throw out the direction I was heading. Does anyone know if new-ncuser has the ability to create SNMPv3 accounts? Or if I'm missing an obvious cmdlet that fills this function? I see when doing a help -full on "new-ncuser" within the -authmethod it states ['usm' and 'community' for 'snmp' application (when creating SNMPv3 users).] but its just not clear how to provide the needed info for AUTH and PRIV.

 

 

 
#Get the AUTH and PRIV for the SNMPv3 account
$SNMPAuth = (Get-Credential -Message "Provide the Authentication ( AUTH ) password for OpenNMS. This should be in the password safe.").Password
$SNMPPriv = (Get-Credential -Message "Provide the Privacy ( PRIV ) password for OpenNMS. This should be in the password safe.").password

#Creates the SNMPv3 account using the two provided passwords
Invoke-NcSsh -Command "security login create -user-or-group-name <SNMPAccountName> -application snmp -authentication-method usm -role readonly -is-ns-switch-group no -comment 'Account is for OpenNMS' -vserver $adminSvmString`n `n md5`n $SNMPAuth `n $SNMPAuth `n des `n $SNMPPriv `n $SNMPPriv `n "
0 REPLIES 0
Public