VMware Cloud Community
Proxmire
Contributor
Contributor

Disabling TCP/IP Filtering

Hello everyone,

I was trying to create a Powershell Script that would disable the TCP/IP Filtering.  I figured that it would be pretty straightforward and I could do this with a couple lines of script using the WMI class win32_networkadapterconfiguration.

Here's what I attempted:

$a=get-wmiobject win32_networkadapterconfiguration -computername "X.X.X.X" | Where{$_.IPenabled -eq "TRUE"}
$a.disableIPSec()

The problem is that I'm trying to run this script to get rid of the "RPC server unavailable" error.  In using the wmi classes in Powershell I'm not able to make a connection and get the exact error I'm trying to remove.

Would anyone know how to get around this dilemma?  Any kind of input or advice would be gladly welcomed.

Best regards

0 Kudos
5 Replies
Proxmire
Contributor
Contributor

Hello Andreas,

Thanks very much for your suggestion.  Invoke-VMscript would definitely work but I'm trying to disable the TCP/IP filtering throughout many VMs which all don't have PowerCLI installed on them.  Unless I'm able to find a BAT file that might do what I need, I wouldn't be able to use the Invoke-VMScript.

Regards

0 Kudos
andreasbrunner
Contributor
Contributor

Is there any firewall enabled?

If so then Netsh firewall set service RemoteAdmin enable via psexec would help

http://www.windowsreference.com/windows-xp/enable-remote-desktop-on-xp-machine-remotely/

Also check http://msdn.microsoft.com/en-us/library/aa822854%28v=vs.85%29.aspx

0 Kudos
LucD
Leadership
Leadership

You don't need PowerCLI to be nistalled on all the target VMs against which you run the Invoke-VMScript cmdlet.

You only need to have the VMware Tools installed on the target VMs.


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

0 Kudos
Proxmire
Contributor
Contributor

Hello LucD,

Thanks a ton for the clarification.  I've tried placing the line get-wmiobject win32_networkadapterconfiguration | $_.disableipsec() into the Invoke-VMScript cmdlet like this:

$a=Get-VM | `
  Where-Object {$_.PowerState -eq "PoweredOn" -and $_.Guest.OSFullName -like "*Windows*"}
Foreach($i in $a){
  Invoke-VMscript -vm $i -ScriptText "get-wmiobject win32_networkadapterconfiguration | $_.disableipsec()"

-ScriptType Powershell -guestuser administrator -guestpassword poiu1poiu
}

The error message that I receive is "An expression was expected after '(' at disableipsec(<<<)"

I'm not sure what I could put in there since I thought the disableipsec method had no parameters.

I've also tried running it from a script like so:

$a=Get-VM | `
   Where-Object {$_.PowerState -eq "PoweredOn" -and $_.Guest.OSFullName -like "*Windows*"}
Foreach($i in $a){
   Invoke-VMscript -vm $i -ScriptText "c:\scripts\process.ps1"

-ScriptType Powershell -guestuser administrator -guestpassword poiu1poiu
}

with process.ps1 containing:

$a=get-wmiobject win32_networkadapterconfiguration | Where{$_.IPenabled -eq "TRUE"}
$a.disableipsec()

but this would give me an error of "The term c:\script\process.ps1 is not recognized as a cmdlet, function, operable  program, or script file. Verify the term and try again." on all other VMs except the one I was running PowerCLI from.  I'm guessing this is since the process.ps1 script isn't physically located on all the other VMs.  On the VM that does have the process.ps1 script and where I have PowerCLI installed, the script does run successfully.

Any additional advice would greatly be appreciated.  Thanks again for everyone's help

0 Kudos