Execute a powershell script

Forums Desktop Info Execute a powershell script

Tagged: ,

Viewing 2 reply threads
  • Author
    Posts
    • #2177
      AvatarMiguel

      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
      GlennGlenn
      Keymaster

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

      0
      • #2186
        Avatarmitoba

        Hi Glenn,

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

        Regards.

        0
        • #2193
          GlennGlenn
          Keymaster

          what do you mean?

          0
    • #2195
      GlennGlenn
      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 10 months, 2 weeks ago by GlennGlenn.
      • This reply was modified 10 months, 2 weeks ago by GlennGlenn.
      0
Viewing 2 reply threads
  • The topic ‘Execute a powershell script’ is closed to new replies.
Do NOT follow this link or you will be banned from the site!