How to execute a PowerShell script using NSIS

Welcome Forums General PowerShell Q&A How to execute a PowerShell script using NSIS

Viewing 1 reply thread
  • Author
    Posts
    • #52313
      Participant
      Topics: 9
      Replies: 16
      Points: 0
      Rank: Member

      Hi all how to can I use NSIS (Nullsoft Scriptable Install System) to execute the power shell script. I have gone through the following link http://nsis.sourceforge.net/PowerShell_support but I couldn't get it so can some one help me on this

    • #52331
      Participant
      Topics: 9
      Replies: 16
      Points: 0
      Rank: Member

      This is how I have written, my nsi file goes as follows

      !include "x64.nsh"
      
      Name "nsExec Test"
      OutFile "nsExecTest.exe"
      #ShowInstDetails show
      
      Section "Output to variable"
          nsExec::ExecToStack 'powershell.exe "& "Import-Module C:\PowerShell\Hello.psm1"'
          Pop $0
          Pop $1
          DetailPrint '"ImportModules" printed: $1'
      SectionEnd
      

      My PowerShell script goes as follows

      # Filename: Hello.psm1
      Write-Host
      Write-Host 'Hello World!'
      Write-Host "Good-bye World! `n"
      # end of script
      

      But can some one help me how can I do the same with the one having parameters

Viewing 1 reply thread
  • The topic ‘How to execute a PowerShell script using NSIS’ is closed to new replies.