Jump to content
Sign in to follow this  
Mistake

change ip

Recommended Posts

Mistake

I must change the ip address for machines whit a script...anyone can help me?

ps: the script must run in admin mode...why the users dont have the permission

tnx :)

Edited by Mistake

Share this post


Link to post
Share on other sites
ChrisL

Something like this using netsh.exe

$userName = "User"
$domain = @ComputerName
$password = "password"
$netname = "Local Area Connection"
$newIP = "192.168.2.12"
$newSubnetMask = "255.255.255.0"
$newDG = "192.168.2.1"


RunAs($userName,$domain,$password,0,'netsh interface ip set address name=' & '"' & $netname & '" static ' & $newIP & ' ' & $newSubnetMask & ' ' & $newDG & ' 1')

Share this post


Link to post
Share on other sites
Mistake

Something like this using netsh.exe

$userName = "User"
$domain = @ComputerName
$password = "password"
$netname = "Local Area Connection"
$newIP = "192.168.2.12"
$newSubnetMask = "255.255.255.0"
$newDG = "192.168.2.1"


RunAs($userName,$domain,$password,0,'netsh interface ip set address name=' & '"' & $netname & '" static ' & $newIP & ' ' & $newSubnetMask & ' ' & $newDG & ' 1')

tnx :)

Edited by Mistake

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×