WMF5 Performance when dot sourcing

Welcome Forums General PowerShell Q&A WMF5 Performance when dot sourcing

Viewing 2 reply threads
  • Author
    Posts
    • #44464
      Participant
      Topics: 7
      Replies: 11
      Points: 0
      Rank: Member

      I noticed some performance issues dot sourcing scripts in modules, taking up to a minute to load in all of the files.

      I tried to investigate and isolate using procmon on a handful of PCs running WMF5.
      The scripts ran instantly on PCS using WMF4, as well as on the WMF5 pcs after uninstalling WMF5.

      To test further, I created a file named test.ps1 with the following contents.

      $t = "hello"
      $t
      

      The procmon capture did not account for the time, unless you include the profiling events, which I believe are irrelevant.

      PS C:\temp2> Measure-Command { .\test.ps1 }
      
      Days              : 0
      Hours             : 0
      Minutes           : 0
      Seconds           : 3
      Milliseconds      : 833
      Ticks             : 38337812
      TotalDays         : 4.43724675925926E-05
      TotalHours        : 0.00106493922222222
      TotalMinutes      : 0.0638963533333333
      TotalSeconds      : 3.8337812
      TotalMilliseconds : 3833.7812
      
      PS C:\temp2> $PSVersionTable
      
      Name                           Value
      ----                           -----
      PSVersion                      5.0.10586.117
      PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
      BuildVersion                   10.0.10586.117
      CLRVersion                     4.0.30319.42000
      WSManStackVersion              3.0
      PSRemotingProtocolVersion      2.3
      SerializationVersion           1.1.0.1
      

      On average it takes 3-5 seconds to load a dot sourced a file.

      Any ideas on what is causing my performance hit, or how I could further troubleshoot this?

    • #44845
      Participant
      Topics: 2
      Replies: 35
      Points: 116
      Team Member
      Rank: Participant

      Hi Michael!

      If you do end up discovering what was causing this, might be worth following up here and your stackoverflow post in case someone else runs into the same issue. Very curious to hear what was causing this.

      Cheers!

    • #44942
      Participant
      Topics: 7
      Replies: 11
      Points: 0
      Rank: Member

      Here is the SO post for anyone interested: StackOverflow Post

      Still waiting to pinpoint the exact cause. I created a test computer and noticed performance was fine on Windows 7.
      Moving the computer into a different OU causes the problem. It looks like it’s down to a GPO, or ePO policy causing the conflict.

      I notice this line in the McAfee Access log each time I try to run a dot sourced ps1.

      Would be blocked by Access Protection rule (rule is currently not enforced) NT AUTHORITY\SYSTEM C:\WINDOWS\SYSTEM32\SVCHOST.EXE C:\Windows\System32\wbem\WmiPrvSE.exe Anti-virus Maximum Protection:Prevent svchost executing non-Windows executables Action blocked : Read

Viewing 2 reply threads
  • The topic ‘WMF5 Performance when dot sourcing’ is closed to new replies.