View Single Post
Old 29th August 2016, 13:23   #3
Chaitanyansis
Junior Member
 
Join Date: Aug 2016
Posts: 14
Quote:
Originally Posted by th_mi View Post
You need to call the powershell executable with the scritpname as parameter.

exec "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file d:\mydir\myscript.ps1"

But you should keep in mind on a 64 bit system there is a 32 bit and a 64 bit powershell installed. It may make a difference what powershell you are using depending on what the script is doing and if you are also using snapins, ....
Hi thanks for the post I have done as following which is working fine

PHP Code:
!include "x64.nsh"

Name "nsExec Test"
OutFile "nsExecTest.exe"
#ShowInstDetails show

Section "Output to variable"
    
nsExec::ExecToStack 'powershell.exe "& "Import-Module C:\Dorababu\PowerShell\Hello.psm1"'
    
Pop $0
    Pop 
$1
    DetailPrint 
'"ImportModules" printed: $1'
SectionEnd 
But the same I would like to achieve which is accepting parameters inside PS module script can you help me on that

This is my PowerShell module script

PHP Code:
# Filename: TestParameter.psm1
function TestParameter([string$TestParam)
{
    
Write-Host
    Write
-Host '$TestParam'
    
Write-Host "Good-bye $TestParam! `n"
}
# end of script 
Chaitanyansis is offline   Reply With Quote