![]() ![]() Once I new this, I could call the original cmdlet version of Get-PSBreakpoint and there were 58 Variable and Command breakpoints with Actions on them. In this code I can see “” and SentinelOne is our antivirus product. If ((Test-Path variable:psBoundParameters) -or $unt) ) $local:origGetPsbreakpoint = Get-Command Get-PSBreakpoint -Type cmdlet $True,ValueFromRemainingArguments = $True,ParameterSetName = "Variable")] The definition on affected machines looked like this: But then I ran a “Get-Command Get-PSBreakpoint | select *” on affected machines, this was CommandType of Function and on non-affected machines it was CmdLet. If I ran Get-PSBreakPoint, it would return nothing. Looking at the reflected code, it would only do this if there were breakpoints currently set in the session. When I do this on my local machine, I can see the _debuggingMode being changed to 0, but when I did this on one of these affected machines, it would remain a “1”. In trying to figure out why this debuggingMode was being set, I discovered the cmdlet Set-PSDebug -Off. $dm = $context.GetType().GetField("_debuggingMode", ::NonPublic -bor ::Instance) ![]() $context = $f.GetValue($ExecutionContext) Here’s I get the value and set it: $f = $ExecutionContext.GetType().GetField("_context", ::NonPublic -bor ::Instance) I’m not sure yet what is causing that.īut I’ve found that if I turn it off, then the script runs quickly again. But I also found that on these servers where the powershell is running slowly, debugging appears to be enabled by default on new powershell sessions. If I had a powershell session where debugging was not enabled, it runs fast. After extracting the relevant code from the script so I could run it on its own for testing purposes, I could see that I get the slow down when running the script in a powershell session where debugging is enabled. I’ve discovered some additional information. Can these things cause this? I’ve tried deploying these windows services from a separate project which just has the one step in it and fewer variables and no shared modules and it can run the same step in about 1 minute which seems to indicate that maybe it has something to do with what is this project. ![]() Is this something that you’ve seen before? We have a lot of variables and shared-modules in the project. I’m having a hard time figuring out what it is doing during this time. As I’ve watched the server processes during this time, the powershell process is basically 100% of one CPU (IE on a two proc server it takes 50% cpu and on a 8 proc server it takes 12-13%). The actual powershell portions of the script seem to run really fast, but in between each step of the step, it’ll take 2-3 minutes. In some of our environments, it only takes 1-2 minutes for the deploy to run, but in other environments it can take 30 minutes. We have windows service deploys that seem to take a lot longer than they should. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |