power shell sample

Oct 13, 2008 at 2:33 PM
can you please write a sample usgae of power shell script.

I need very simple one just to see how to add the refrence and set the counter

thanks in advance
Oct 13, 2008 at 10:32 PM
Here's a very simple one to generate a random number and send it back to PolyMonRT:

$rand = New-Object system.random
$PolyMonRT.Counter = $rand.next(1,100)

Basically you just need to set $PolyMonRT.Counter = <some value (double type)>

Hope this helps,
Oct 14, 2008 at 7:39 PM
## code starts here

1# $rand = New-Object system.random
2# $PolyMonRT.Counter = $rand.next(1,100)
Property 'Counter' cannot be found on this object; make sure it exists and is settable.
At line:1 char:12
+ $PolyMonRT.C <<<< ounter = $rand.next(1,100)

## code ends here

how do I make power shell recognized PolyMonRT object ?

Oct 15, 2008 at 11:49 PM
Are you running this script from within PolyMonRT itself or are you loading up a separate PowerShell shell?
The only way PowerShell will be aware of the $PolyMonRT object is if the powershell script was kicked off by PolyMonRT itself (i.e. you need to paste your PS script into the text box provided by PolyMonRT). PolyMonRT then executes the PS script and passes it the PolyMonRT object.

Hopefully this is the issue as I had tested this succesfully on both Vista and XP.
Let me know, otherwise maybe someone else has some ideas?
Oct 16, 2008 at 8:21 AM