Wednesday, June 19, 2013

run commands against AD domain members via flexcommand.hta

Execute commands against AD Domain Members via web-interface.

Thanks to the article How to Force Remote Group Policy Processing, I found "flexcommand.hta" compliments of Mr. Jakob H. Heidelberg of Copenhagen, Denmark.

First, I've repaired the original for use on Windows7 and 2008 as per Mr. Eirik Andreassen's comment.

I've also edited the original to allow for larger fields including the OU dropdown box and enabled the "sub-OU's" and "alive-only" options by default. 

Download the full flexcommand.hta here or the diff patch to compare.  It has to be run with domain admin privileges and without UAC.

Here are some useful example psexec commands:

psexec.exe \\{C} -e -h -d gpupdate.exe /force

psexec.exe \\{C} -e -h -d wuauclt.exe /reportnow

psexec.exe \\{C} -e -h -d \\\netlogon\WUInstall.exe /install /criteria "IsHidden=0 and IsInstalled=0 and IsAssigned=1"
(depends on WUInstall on accessible share)