Import-Module pspki take long time as system account

Sep 8, 2015 at 5:42 PM
if I import as SYSTEM account the pspki module it toke over a minute. I can reproduce that on server 2012 R2. As a user it works fine in a few seconds. Any idea? With "procmon" you can see that powershell constantly read some registry keys all the time. At the eventlog I can't find anything. Do you know a way to debug the import-module process?

Sep 8, 2015 at 5:51 PM
I think, the delay is caused by a script signature validation process.
Sep 8, 2015 at 6:10 PM
Hi Camelot,
do you know how to disable that?
Sep 8, 2015 at 7:12 PM
No, it is impossible to disable digital signature validation procedure.
Sep 8, 2015 at 7:29 PM
What can I do to speed up that process? As a user it is no problem. On a server 2008 R2 it is also no problem as System account. Any idea?
Sep 8, 2015 at 7:36 PM
Edited Sep 8, 2015 at 7:38 PM
I found out that this is the module which cause the issue "VERBOSE: Loading module from path 'C:\Program Files\Sysadmins LV\PowerShell PKI Module\pspki\PSPKI.psm1. Any idea?
Sep 8, 2015 at 7:39 PM
This is a general message. Module loading process includes a lot of things and I can't tell what exactly creates a delay in your case. Another possibility is that the code fails to load format and extended type files.
Sep 8, 2015 at 8:19 PM
I may found it, the psm1 file stay for about 60 seconds at this line. BTW: onyl one time. If I run a second time the script it works like a charme.

Get-ChildItem -Path $PSScriptRoot -Include *.ps1 -Recurse | Foreach-Object { . $_.FullName }
Sep 8, 2015 at 8:23 PM
BTW: If you like to reproduce you can start a system powershell with: "psexec -i -s Powershell.exe" and import the module with "import-module pspki -debug -verbose"
Sep 15, 2015 at 11:27 AM
any idea?