Wednesday, July 28, 2010

Running process using PsExec in elevated mode (undocumented)

If you need to run process on target machines your probably already using PsExec which is part of PsTools.

There is one hidden gem in the documentation of PxExec about how to run remote process in elevated way, apparently its so simple, just use “-h” argument

The command line help for this (not found in the CHM/Web) is

If the target system is Vista or higher, the process run with the account's elevated token, if available.”

Enjoy (Thanks to Evyatar Ben Shitrit for this tip)

Monday, July 26, 2010

Who is creating that file question

During our integration tests we saw that there is file called "d.xml" created in one of the folders in our configuration directory, we have lots of processes touching that directory (Read & Write) and also few processes that host multiple plugins (potentially could write that files)
So it was really hard trying to understand who is the bustard
We came up with few quick alternatives on how to find it:
  1. Send mail to all team leaders asking if they know about it (that didn't do any good coz they didn't)
  2. Iterate on all the source code and searching for "d.xml"
  3. before we start the processes, create d.xml as readonly and see which process breaks / look at the logs - we used this approach and got the answer in 1 minute
  4. start reducing processes who run (binary search) - but that will take too much
Any other clever and technical way (that will find the process and the specific plugin if it the one to blame)?

By the way the bustard is me :( (one of my subsystems wrote this debug file dump)

Tuesday, July 13, 2010

VMWare (or any) CPU core speed is limited by the host’s physical core speed

This is just a reminder that in VMware (and maybe other Virtualization environments) even if you set the CPU quota to be unlimited you are still LIMITED per core you assigned for each guest for the maximum of the physical host machine.

So for example if you have a 8 * 2.33GHZ host and 1 guest that has 2 cores assigned –> effectively although you didn’t set  MAX CPU assigned it will have maximum of 4.66GHZ

I faced this while analyzing performance issue on VMware and we didn't understand how come guest was on 85% CPU consumption and host was on less than 20%

Maybe it was trivial for you, but for me it was new.

Thanks now we continue to IO issues (that's harder)

Fail to extract PROGRAMFILES(X86) environment variable using powershell

After long time, today i wasted almost 30 minutes on a stupid mistake, i tried to have a PS script that will run a program from “%ProgramFiles(X86)\A-Program.exe”

So i tried using “$Env:PROGRAMFILES(X86)\A-Program.exe” and it failed coz it said its trying to run from: “c:\program files(X86)\A-Program.exe” and directory doesn’t exist

so after digging i saw that the problem is powershell took the first part of the string and extracted the programfiles environment variable :( (there was no space between it and the (X86) ), than again how was he suppose to know…

Solution was to use: “${env:PROGRAMFILES(X86)}\A-Program.exe”

Hope it will save you some time