LeviDaily
asked on
Change IP Address using Run As
We have Netbooks that our technicians use. Their user account is a standard user. We cant give them administrative rights on the Netbooks but need to allow them to be able to change their IP Addresses on the Local Area Connection. Is there a way to do this? When I am logged in as them there is no way of right clicking and using Runas or any options? Any ideas? Any 3rd party software?
ASKER
I found this batch file which is AWESOME! The problem is the user has to right click and run as different user. I know we cant save the password for the runas in the batch file. Can I create a .vbs script to use the runas command and have the password saved and call on the batch file below?
ChangeIPAddress.txt
ChangeIPAddress.txt
I'm not an expert in programming but you can try digging in the Internet and convert this batch file to exe file using AutoIt.
AutoIt download
http://www.autoitscript.com/site/autoit/
Then everything will be compiled and they will run only the EXE file :)
Krzsztof
AutoIt download
http://www.autoitscript.com/site/autoit/
Then everything will be compiled and they will run only the EXE file :)
Krzsztof
Try this. Save it as a vbs script. It issues a runas command calling your batch file.
OM Gang
intSleep = 250 'milliseconds to wait until we send the password
strPass = "password" 'admin acount password
Set objNet = CreateObject("WScript.Netw ork")
Set wshShell = CreateObject("WScript.Shel l")
strThisComputer = objNet.ComputerName
'build RunAs command so we can execute msg command as priveleged user
strRunAsCmd = "runas /noprofile /user:" & strThisComputer & "\administrator "
'build command to send network message
strNetCmd = "ChangeIPAddress.bat"
strFullCmd = strRunAsCmd & Chr(34) & strNetCmd & Chr(34)
wshShell.Run strFullCmd
WScript.Sleep intSleep
wshShell.SendKeys strPass & "~"
OM Gang
intSleep = 250 'milliseconds to wait until we send the password
strPass = "password" 'admin acount password
Set objNet = CreateObject("WScript.Netw
Set wshShell = CreateObject("WScript.Shel
strThisComputer = objNet.ComputerName
'build RunAs command so we can execute msg command as priveleged user
strRunAsCmd = "runas /noprofile /user:" & strThisComputer & "\administrator "
'build command to send network message
strNetCmd = "ChangeIPAddress.bat"
strFullCmd = strRunAsCmd & Chr(34) & strNetCmd & Chr(34)
wshShell.Run strFullCmd
WScript.Sleep intSleep
wshShell.SendKeys strPass & "~"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
runas /user:<AdminUser@yourdomai
and in that new window use
netsh interface ip set address name="Local Area Connection" static IPAddress NetworkMask Default Gateway
netsh interface ip set dns "Local Area Connection" static <DNSIPAddress> primary
netsh interface ip set dns "Local Area Connection" static <DNSIPAddress> secondary
where Local Area Connection is a name of NIC card on that PC.
i.e.
netsh interface ip set address name="Local Area Connection" static 192.168.1.10 255.255.255.0 192.168.1.254
netsh interface ip set dns "Local Area Connection" static 192.168.1.1 primary
netsh interface ip set dns "Local Area Connection" static 192.168.1.2 secondary
Regards,
Krzysztof