Execute a powershell script

Forums Desktop Info Execute a powershell script

Tagged: ,

Viewing 2 reply threads
  • Author
    Posts
    • #2177
      Miguel

      Hi everybody,

      I’m trying execute a powershell script with CMD Command but I’m not be able, it doesn’t work. I’ve a script to check updates pending properly, and manually it works and write the exit in a text file.

      I follow the manual but DTI does’t execute the script .ps1.

      Somebody have an example to execute a powershell script?

      Thanks in advance.

      0
    • #2180
      Glenn
      Keymaster

      I couldn’t get it to execute either. I’ll look into it.

      0
      • #2186
        mitoba

        Hi Glenn,

        I could execute a powershell script but Ho Can I hide the command line in DTI?

        Regards.

        0
        • #2193
          Glenn
          Keymaster

          what do you mean?

          0
    • #2195
      Glenn
      Keymaster

      The issue is execution policy. To make it work for me I have to type the following in to a Powershell command line window:

      Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

      This allows DTI to run a script. This is the script I tested:

      test.ps1

      Get-WMIObject -Class Win32_Processor -ComputerName . | Select-Object -Property SystemName | Format-List | Out-String | ForEach-Object { $_.Trim() } | Out-File -Encoding ascii -FilePath results.txt
      exit 667
      

      The line with “exit 667” puts the 667 exit code on the DTI display to assure me the script actually executed.

      This is the call in desktopinfo.ini:

      CMD=active:1,interval:10,file:powershell.exe,directory:d:\temp,parameters:-File test.ps1
      FILECONTENTS1=active:1,interval:10,file:d:\temp\results.txt
      
      • This reply was modified 1 year, 8 months ago by Glenn.
      • This reply was modified 1 year, 8 months ago by Glenn.
      0
Viewing 2 reply threads
  • The topic ‘Execute a powershell script’ is closed to new replies.
Glenn's Page