I am running command from Remote Server
invoke-command -computername server1 -filepath c:\host.ps1
Inside host.ps1
----------------------------------------
import-module "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\NetworkLoadBalancingClusters"
Get-NlbCluster | Add-NlbClusterNode -NewNodeName server2 -NewNodeInterface “Local Area Connection”
---------------------------------------------
Although this command works on server.
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
+ CategoryInfo : PermissionDenied: (Microsoft.Netwo...dNlbClusterNode:AddNlbClusterNode) [Add-NlbClusterN
ode], UnauthorizedAccessException
+ FullyQualifiedErrorId : AccessDenied,Microsoft.NetworkLoadBalancingClusters.PowerShell.AddNlbClusterNode