Hi Chris,
I'm not certain what would be causing the cmdlet to crash your powershell session but here is a workaround by invoking the ZAPI.
#'------------------------------------------------------------------------------
Param(
[Parameter(Mandatory=$True, HelpMessage="The cluster to connect to")]
[String]$Cluster,
[Parameter(Mandatory=$True, HelpMessage="The credentials for the cluster")]
[System.Management.Automation.PSCredential]$Credentials
)
Import-Module DataONTAP
Connect-NcController -Name $Cluster -HTTPS -Credential $Credentials
$request = New-Object "System.Xml.XmlDocument"
$request.LoadXml("<cluster-log-forward-create>
<destination>wfa.testlab.local</destination>
<facility>user</facility>
<force>false</force>
<port>514</port>
<protocol>udp-unencrypted</protocol>
<return-record>true</return-record>
<verify-server>false</verify-server>
</cluster-log-forward-create>")
Write-Host "Invoking the 'cluster-log-forward-create' ZAPI"
$request.'cluster-log-forward-create'
$response = Invoke-NcSystemApi $request
$response.results."cluster-log-forward-info"
#'------------------------------------------------------------------------------
Here is an example usage:
PS C:\Scripts\PowerShell\Projects\CreateClusterLogFoward> .\CreateClusterLogFoward.ps1 -Cluster cluster2.testlab.local -Credentials $credentials
Name Address Vserver Version
---- ------- ------- -------
cluster2.testlab.... 192.168.100.3 NetApp Release 9.1: Thu Dec 22 23:05:58 UTC 2016
Invoking the 'cluster-log-forward-create' ZAPI
destination : wfa.testlab.local
facility : user
force : false
port : 514
protocol : udp-unencrypted
return-record : true
verify-server : false
And from the CLI it now shows the cluster log foward configuration:
cluster2::> cluster log-forwarding show
Verify Syslog
Destination Host Port Protocol Server Facility
------------------------ ------ --------------- ------ --------
wfa.testlab.local 514 udp-unencrypted false user
Hope that helps
/Matt
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.