Tag Archives: Sysinternals

Setting Dns entries on network properties from remote.

Tricky one recently where the server wasnt responding to RDP… the DNS entries on this webserver were incorrect and it couldnt lookup its connection to an oracle database.

I connected over psexec, and used netsh to dump the current configuration.

  • netsh  interface  ip  dump

this command should give you an output similar to below:

# ———————————-
# Interface IP Configuration
# ———————————-
pushd interface ip

# Interface IP Configuration for “Local Area Connection 5″

set address name=”Local Area Connection 5″ source=static addr=192.168.1.20 mask
=255.255.255.0
set address name=”Local Area Connection 5″ gateway=192.168.1.1 gwmetric=0
set dns name=”Local Area Connection 5″ source=static addr=192.168.1.115 register=PRIMARY
add dns name=”Local Area Connection 5″ addr=192.168.1.116 index=2
popd
# End of interface IP configuration

looking at the above,

To set the primary server the command would be:

netsh interface ip set dns name=”Local Area Connection 5″ source=static addr=192.168.1.115 register=PRIMARY

and to set the secondary:

netsh interface ip add dns name=”Local Area Connection 5″ addr=192.168.1.116 index=2

you can set more than two if you like using the above command and incrementing the “index” by one.

how to add a domain user to the local admins on multiple servers.

Needed to add a user to the local administrators on 16 citrix servers, below is the code if you need it.

psexec @servers.txt cmd /c “net localgroup Administrators /add domainusername”

this doesnt work with multiple usernames at one time.

get psexec here: www.sysinternals.com

servers.txt is a text file containing a list of servers, i.e:

server1

server2

etc

A

How do i find out whats holding my file open?

Had this asked of me recently,

A database administrator couldn’t remount an oracle database as the file was in use, resulting in my HR department feeling all cold and lonely outside of their application! There was no reference of the file in use in task manager and no implication as to what file was using it.

To find out what had the file open i used an application from Sysinternals called process explorer. You can use procexp.exe to find open files. Launch Procexp.exe and click find > Find Handle or DLL.

Enter the filename in the search box and wait for it to show you what has the file open! then simply kill the process using it. If its a system process, you can expect an error or a lovely blue screen for your hassle, But on the reboot you should be grand :)