Jump to content

Recommended Posts

Posted

Hello,

 

Been haveing some troubles with the script below i was wondering if anyone had any ideas?

When it runs it completes with an error 66, the gatway and dns change to the entered one but not the IP or subnet

 

$IP = Read-Host "Enter IP address (10.10.10.2)"

$MASK = Read-Host "Enter Subnet address (255.255.255.0)"

$GATEWAY = Read-Host "Enter Gateway address (10.10.10.254)"

$DNS = Read-Host "Enter DNS address (10.10.10.2)"

 

$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"

 

$wmi.EnableStatic($IP, $MASK)

$wmi.SetGateways($GATEWAY)

$wmi.SetDNSServerSearchOrder($DNS)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...