Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a .exe 1

Status
Not open for further replies.

linzwhittles

Technical User
Jul 7, 2000
59
GB
Hi,

Not sure if this is the correct place to do this but im after creating a .exe to hold a text command file and also get this to do as "Run as - Administrator" so the .exe will actually work.

Cheers

Linz


p.s. basically i need set it so someone can change there IP Address automatically by clicking on a .exe file on their desktop as we have several networks not on DHCP and the laptops flit between them. Basically we have this command line they can run to do this but it needs to be run as an administartor and of course we cant just give people administrator access.
 
You do not need to run as administrator in this instance. Win2k and XP both provide support for the Netsh.exe utility, which is perfectly batcabhle and scriptable.

For a tutorial on how to use this magic little utility of XP:
On the users desktop you create a New Shortcut by right-clicking on an empty area, New, Shortcut.

Let say you have followed the tutorial above and created a settings file "C:\Office1.txt"

The shortcut "Target" would then be:
netsh -f C:\Office1.txt

In the alternative you can create a shortcut to Netsh to directly change the static IP assignments without using "dump" files:

The shortcut "Target" would then be:

netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric

Note: Replace ipaddr with the static IP address, subnetmask with the subnet mask, gateway with the default gateway and, if necessary, metric with the appropriate metric. The following example changes the interface "Local Area Connection" to a static address of 192.168.0.10 with a subnet mask of 255.255.255.0, and the interface has a default gateway of 192.168.0.1 with a metric of 1:

For this example, the shorcut "Target" would read:

netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1
 
Yes but when you run this as a normal user you get access is denied. To Change IP Address of the PC/Laptop you would need to be an administrator?
 
What i am wanting is for our users on the network to be able to change this Ip address themselves as we have docotors that work on different networks, basically they are not administrators and i need a way to set that command to run as an administrator when they click on it.....any ideas?
 
Of course without giving them the administrator password etc.
 
I am surprised there is a permissions issue, but it is possible. You could use Start, Run, gpedit.msc and permit at least by users or to Group Everyone the ability to modify network connection details. This is a very small compromise on locked down workstations.

In the alternative:
Add to the shortcut as a preface the RUNAS command. This will allow you to pass as credentials the username and password of a priviliged user.

Details:
 
Using gpedit.msc

Look under:

Local Computer Policy
Computer Configuration
Administrative Templates
Network
Network Connections

A limited user is normally given no priviliges here. For trusted notebook users this seems silly. Try relaxing at least the GPO's that deny access to the properties of the lan connection, and deny access to TCP/IP advanced properties. You may need to relax one or two other items.
 
In the interest of completeness:

. For domain settings the changes in Group Policy will need the assistance of the Domain administrator;

. I believe that adding the user a member of the XP defined group Power Users will workaround the GPO limitations on a member of just the limited user group. Start, Run, lusrmgr.msc Highlight the user, double-click, Member of, Add, and include them in the Group Power Users; (I unforutnately cannot test this at the moment, but I believe the power user groups is defaulted on all Network connections settings GPOs).

3. It would be worth your while to evaluate Third-Party tools. Two I have tested and like:

NetSwitcher

Mobile NetSwitch

Your users may find either of these a more elegant solution. But the permissions issue is best handled by Mobile NetSwitch, as it allows you to define alternate credentials inside the application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top