"Access denied" error while enabling ICMP
Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -enabled True -RemoteAddress "192.168.0.5" -Protocol ICMPv4 -IcmpType 8 -Direction Inbound -Action Allow
Any assistance that I can get would be much appreciated.
Thank you
The Set-NetFirewallRule cmdlet requires the user running it to be a local administrator.
You can allow other accounts to create/change FW rules, but that requires setting policy and permissions in the Windows OS.
You will see the same error when you run this via the netsh command.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is a PowerShell cmdlet, you're trying to change the behaviour of Windows regardless of it running in a VM - so technically not anything to do with PowerCLI or any VMware product.
The Set-NetFirewallRule cmdlet requires the user running it to be a local administrator.
You can allow other accounts to create/change FW rules, but that requires setting policy and permissions in the Windows OS.
You will see the same error when you run this via the netsh command.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I was successfully able to enable ICMP echo using below cmdlet with administrator role
netsh advfirewall firewall set rule name="File and Printer Sharing(Echo Request - ICMPv4-In)"
protocol=icmpv4:8,any dir=In new enable=yes
But can we achieve this using PowerCLI cmdlet ,enabling multiple vms(Ex: IPs) simultaneously via script?
I meant enabling ICMP echo in multiple vms using their IP's in a script?
Is the account which you pass via Invoke-VMScript on the GuestCredential parameter a local administrator in the Guest OS?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried both ways but either I get access denied error or username/pwd is incorrect.
New-PSSession -ComputerName "VM-001" -Credential (Get-Credential) -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck)
Enable-NetFirewallRule -DisplayName "ICMP Allow incoming V4 echo request"
Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -enabled True -RemoteAddress "192.168.0.5" -Protocol ICMPv4 -IcmpType 8 -Direction Inbound -Action Allow
Did you try to run the netsh command inside the Guest OS via the Invoke-VMScript cmdlet?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference