Wiki Link: [discussion:3393]
PowerShellPack on W2K3? 

May 11 2010 at 10:31 PM
I've installed PowerShell 2 and the PowerShellPack on a W2K3 server, but find that the TaskScheduler module doesn't work. For instance, if I run the following script:

New-Task |
Add-TaskTrigger -Daily -At "00:10" -Repeat (New-Timespan -Minutes 10) -Until "23:50" |
Add-TaskAction -script {C:\Temp\MyApp.exe} |
Register-ScheduledTask "Run MyApp"

I get the following error:

Unable to find type Diagnostics.Eventing.Reader.EventLogRecord: make sure that the assembly containing this type is loaded.
At C:\Documents and Settings\DKeaveny\My Documents\WindowsPowerShell\Modules\TaskScheduler\Add-TaskTrigger.ps1:122 char:49
+ Diagnostics.Eventing.Reader.EventLogRecord <<<<
+ CategoryInfo : InvalidOperation: (Diagnostics.Eve....EventLogRecord:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound

which I'm guessing means that some functionality required by PowerShellPack is not available on W2K3 (the script ran OK on my Vista PC). Is that correct, or am I missing something more obvious?

Oct 4 2011 at 10:39 AM
Seeing the same message here, but I know for certain that scripts I ran using TaskScheduler last year completed on W2K3. (I had scheduled tasks already installed and running via PS on a box that today is faiing with the above message ). he only think I can think of is that I allowed some windows updates on to the box today (including updates to .Net 4)...

Oct 4 2011 at 12:43 PM
I added this line:


to the top of Add-TaskTrigger.ps1 and all was well..

Page view tracker