Thoughts from Dan Miser RSS 2.0
# Friday, April 27, 2012
I needed a way to get a list of specific scheduled tasks running on a server. The main problem is that the command-line tool, schtasks.exe, is horrid. There is no ability to filter data. You get all of the data, or you get none. This is the Powershell script that I eventually settled on after piecing together a bunch of StackOverflow and blog entries. The key is the convertfrom-csv cmdlet that turns the result into objects that can be queried on, instead of a list of strings.

It's my first time using Powershell, and I don't know quite what to think. While it helped me solve my objective, and is quite powerful and extensible, it just doesn't feel natural to me. I'm sure that would change over time if I decide to invest time and energy to grok it. If anyone knows of a less awkward LINQ syntax, please let me know because that would turn me around on Powershell in a heartbeat.


schtasks /query /v /fo:csv | convertfrom-csv | where {$_.'Task To Run' -like '*MyProcess.exe*' }
Friday, April 27, 2012 8:36:50 AM (Central Daylight Time, UTC-05:00)  #    Comments [4] -

Saturday, May 19, 2012 12:26:11 PM (Central Daylight Time, UTC-05:00)
I like your website I can't wait to read the next posts !
Fanny from ethylometre
Wednesday, June 20, 2012 9:36:31 PM (Central Daylight Time, UTC-05:00)
Excellent, our Sys Admin people didn't seem to worry about this, were happy to open as many PS Windows as it took to exorpt multiple mailboxes one at a time! Other sites on the web suggested using ps1 scripts but they seemed to dump all users into one PST (which was called .pst !!)As Compliance Analyst who gets lumbered with Litigation Holds which I used to execute in ExMerge, this is an absolute vboon.Thanks againCheers
Thursday, June 21, 2012 1:45:22 PM (Central Daylight Time, UTC-05:00)
Wednesday, June 27, 2012 2:37:51 AM (Central Daylight Time, UTC-05:00)
Would like to re-establsih contact.
Tony BLomfield
Comments are closed.
Navigation
Archive
<May 2013>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2013
Dan Miser
Sign In
Statistics
Total Posts: 391
This Year: 2
This Month: 2
This Week: 0
Comments: 674
Themes
Pick a theme:
All Content © 2013, Dan Miser
DasBlog theme 'Business' created by Christoph De Baene (delarou)