Forum Discussion

sjames's avatar
sjames
New Contributor
7 years ago
Solved

power shell scripts not running as expected using testcomplete script

Hello All,   My requirement: 1. get version number of installed app under test before the test starts. am using a powershell script for this. Get-ItemProperty HKLM:\Software\Microsoft\Windows\Cu...
  • sjames's avatar
    7 years ago

    Hi Nis,

    That's the issue, I have not getting any error message and power shell window just open and closed. Seems working but not getting expected results.

    I have somehow resolved the issue by adding CLR Bridge > browse GAC > added system.management.Automation and below script, now seems working!!

    var powerShellScript = "AppVersion.ps1"; // script is in the original message

    function getVersionOfInstalledAppUnderTest()

     

    {

      var currentDirectory = aqFileSystem.GetCurrentFolder();

      psScriptPath = currentDirectory + "\\" + powerShellScript;

      var PowerShell = dotNET.System_Management_Automation.PowerShell.Create();

      PowerShell.AddScript(currentDirectory + "\\" + powerShellScript);

     // invoke powershell to get the results

     var results = PowerShell.Invoke();

     

    }