Skip to main content
Solved

System Caller calling a Powershell script

  • September 20, 2019
  • 4 replies
  • 480 views

wunderkind
Forum|alt.badge.img

I'm trying to call a PowerShell script using the System Caller transformer. The syntax of the system caller command line is: C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -file "C:<path>powershell_script.ps1"

I'm using it to access ProjectWise and run some process. I have tested it with PowerShell and it only works with Admin rights. However it does not work within FME and does not recognize the Powershell module commands for ProjectWise. The error I get is:

'New-PWLogin : The term 'New-PWLogin' is not recognized as the name of a cmdlet, function, script file, or operable'

I have tried running the workbench with Admin rights but it still gives the same error.

Best answer by wunderkind

I have been able to resolve this issue:

It was related to the install of the PowerShell module.

1. Ensure you install the PowerShell module with Admin rights using the syntax:Update-Module pwps_dab -Verbose

2. Ensure the module installs to the location: C:\\Program Files\\WindowsPowerShell\\Modules (a directory named pwps_dab will be installed).

3. Ensure your 'PSModulePath' is referencing the above location.

This Bentley article was helpful:https://communities.bentley.com/products/projectwise/content_management/f/projectwise-powershell-extensions-forum/143840/update-we-have-changed-the-way-we-are-delivering-pwps_dab

 

View original
Did this help you find an answer to your question?

4 replies

wunderkind
Forum|alt.badge.img
  • Author
  • September 20, 2019

shout-out to Shaun Dempsey for the PS script


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • September 20, 2019

Hi @wunderkind,

This is typical when FME cannot run the command. According to the documentation:

If paths contain spaces, enclose the path in double quotes, and only on Windows enclose the entire command in double quotes. For example:

""C:\\run me\\something.exe" -filepath "C:\\path here\\filename.txt""

Hope this helps,

Itay


wunderkind
Forum|alt.badge.img
  • Author
  • September 24, 2019
itay wrote:

Hi @wunderkind,

This is typical when FME cannot run the command. According to the documentation:

If paths contain spaces, enclose the path in double quotes, and only on Windows enclose the entire command in double quotes. For example:

""C:\\run me\\something.exe" -filepath "C:\\path here\\filename.txt""

Hope this helps,

Itay

Hi @Itay,

System Caller: Failed to Execute "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -ExecutionPolicy Bypass -file "C:<path>powershell_script.ps1"

When I use : C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -file "C:<path>powershell_script.ps1", I get an error in loading the PowerShell command as described above so it seems that latter syntax works although invoking PowerShell with system caller but from the error I get it does not load the ProjectWise commands installed with the module called pwps_dab so I'm thinking this is more a PowerShell problem.


wunderkind
Forum|alt.badge.img
  • Author
  • Best Answer
  • September 25, 2019

I have been able to resolve this issue:

It was related to the install of the PowerShell module.

1. Ensure you install the PowerShell module with Admin rights using the syntax:Update-Module pwps_dab -Verbose

2. Ensure the module installs to the location: C:\\Program Files\\WindowsPowerShell\\Modules (a directory named pwps_dab will be installed).

3. Ensure your 'PSModulePath' is referencing the above location.

This Bentley article was helpful:https://communities.bentley.com/products/projectwise/content_management/f/projectwise-powershell-extensions-forum/143840/update-we-have-changed-the-way-we-are-delivering-pwps_dab

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings