开发者

Powershell: some modules unavailable when called via CreateProcess()

开发者 https://www.devze.com 2023-01-23 21:39 出处:网络
Under what conditions do some PowerShell modules become unavailable? When I create a process with CreateProcess() and the command line

Under what conditions do some PowerShell modules become unavailable?

When I create a process with CreateProcess() and the command line

powershell -Command "Get-Module -ListAvailable"

I don't get all the modules I get when executing the same statement from a command prompt.

Are there any fields I have to set inside the STARTUPINFO or PROCESS_INFOR开发者_Python百科MATION structs?


Some modules are not available in the 32 bit version of PowerShell. On Windows Server 2008 R2 with PowerShell v1.0 these are:

  • ADRMS
  • AppLocker
  • BestPractices
  • ServerManager


The set of modules available is controlled by the PSModulePath environment variable. It's possible that the two processes in question here have 2 different values for PSModulePath and hence you see 2 different sets of modules.

Can you check the value in both cases and see if it's different?

0

精彩评论

暂无评论...
验证码 换一张
取 消