I'm working on creating a script that will fire off performance counters and store them in a .csv file, rolling over when the file gets too big. Running the script from a powershell prompt or the ISE (I'm running v.2/win server 2008) works just fine, and the files are running correctly.
However, when I try to execute the command using the following cmd prompt line (even trying the /k switch on cmd), the command prompt closes immediately and the file is not getting run.
powershell.exe -windowstyle hidden {iis_test.ps1}
I've also tried the following, and although I see Powershell doesn't stop (I monitor it via task manager, looking for Powershell.exe to show up), I'm not seeing the file being created.
powershell.exe -noexit -windowstyle hidden {iis_test.ps1}
Nor am I seeing any errors being caught in any of the likely places (event viewer, the command prompt window itself).
Any ideas? Ultimately, my goal is to have a vb winforms thing call these script files, and naturally I thought figuring out the command prompt command would be helpful. Note that it is very important that this script be portable, and run on any Windows 2008 Server system (so I need to stay away from third party entities that would require further installation).
EDIT: I needed to use the -file argument to specify a file to run.