VMware Cloud Community
tdubb123
Expert
Expert

invoke-vmscript to bypass firewall?

I am getting firewall ports blocking when running some remote ms cmdlets to windows machines

will invoke-vmscript bypass firewall?

trying to do this

$servers = get-content servers.txt

foreach ($server in $servers)

get-gpresultantsetofpolicy -computer $server -reporttype html -path c:\report\$server.html

}

but getting lot of rpc errors

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

With Invoke-VMScript your script will run inside the guest OS.

It is copied and started there through the VMware Tools.

You need to have port 902 open between the ESXi node hosting the VM and the VM itself.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tdubb123
Expert
Expert

i believe its opened

would something like this work?

$servers = get-content servers.txt

$scripttext = get-gpresultantsetofpolicy -reporttype html -path "c:\reports\$server.html"

foreach ($server in $servers){

invoke-vmscript -VM $server -scripttext $scripttext

}

Reply
0 Kudos
LucD
Leadership
Leadership

Try like this.

The results of your cmdlet that is executed inside the guest OS, is returned in the property ScriptOutput.

$servers = Get-Content servers.txt

$scripttext = @'

Get-GPResultantSetOfPolicy -reporttype html -path "c:\reports\$server.html"

'@

foreach ($server in $servers){

    Invoke-VMScript -VM $server -scripttext $scripttext |

    select -ExpandProperty ScriptOutput

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos