Enthusiast
Enthusiast

How to enable Ping (ICMP echo) on a guest VM

Jump to solution

"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

ICMP.PNG

Any assistance that I can get would be much appreciated.

Thank you

0 Kudos
1 Solution

Accepted Solutions
Leadership
Leadership

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

View solution in original post

7 Replies
Leadership
Leadership

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.

0 Kudos
Leadership
Leadership

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

View solution in original post

Enthusiast
Enthusiast

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?

0 Kudos
Enthusiast
Enthusiast

I meant enabling ICMP echo in multiple vms using their IP's in a script?

0 Kudos
Leadership
Leadership

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

0 Kudos
Enthusiast
Enthusiast

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

0 Kudos
Leadership
Leadership

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

0 Kudos