Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

scriptblock issues

$
0
0

Hi All

I am adjusting a script that someone wrote that does a check of a Citrix XenDesktop environment.  I added some additional checks to it that seem to work very well however it takes about 2 hours to run (it is checking against several thousand desktops).  I am trying to break some of the desktop checks in to a script block and multithread this a bit. 

First issue

I have a logme function called higher up in the script that is outside the scriptblock, this seems not to work unless you put it is the script block to which I run into another issue of the file being open as many background jobs that are running (due to the script block) are updateing this at the same time.

Q1: does it have to be in the script block ?  if not how would I call that function from with in the script block so I don't have to repeat the code?

Q2: How can I have it update the logfile when all of the background jobs are doing this at the same time?

 

Magnus


Viewing all articles
Browse latest Browse all 6937

Trending Articles