I tryed to execute ppkg with multiple sintax : ExecuteWait,ShellExecute,nsExec::ExecToStack
When i execute with nsExec
nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy Unrestricted -File "$INSTDIR\tempfile.ps1" '
on "tempfile.ps1" i have : Invoke-Item "ppkg_path.ppkg"
, nothing happening.My messages are:
First :
0(succes)
Second:
---------------------------
Provisioning OS deployment Setup
---------------------------
Invoke-Item : Application not found
At C:\Users\Ycos3D\Desktop\Provisioning OS deployment\tempfile.ps1:1 char:1
+ Invoke-Item "<ppkg path>"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (🙂 [Invoke-Item], Win32Exception
+ FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.P
owerShell.Commands.InvokeItemCommand
---------------------------
OK
---------------------------
When i execute the command in powershell with the same parameters , the ppkg is running.
I tryed ExecWait '"C:\Windows\System32\provtool.exe" "<ppkg_path.ppkg>" ' , nothing happening.
When i run same command from cmd , the ppkg is running
Executing .ppkg
17 posts
Use the full path to the ppkg.
ppkg_path is the full path
That's a relative path, like Anders said, use a full (absolute) path. Where are you extracting the file to? That's the full path you should be using.Originally Posted by Ycos3D View PostI tryed ExecWait '"C:\Windows\System32\provtool.exe" "<ppkg_path.ppkg>" ' , nothing happening.
ppkg_path=C:\Users\Ycos3D\Desktop\Provisioning OS deployment\
Is not the full path?
In my script is "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\packagename.ppkg"
Is not the full path?
In my script is "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\packagename.ppkg"
Please try to execute an .ppkg(Provisioning package) file in NSIS.
So have you tried it like this:
Is 'ppkg_path' an environment variable? Also, for provtool.exe you should be using $SYSDIR instead of an absolute path.Originally Posted by Ycos3D View PostExecWait '"C:\Windows\System32\provtool.exe" "<C:\Users\Ycos3D\Desktop\Provisioning OS deployment\packagename.ppkg>" '
I use 'ppkg_path' just in this thread. in my script is use absolute path. I will try $sysdir for system32.
Please try to execute an .ppkg(Provisioning package) file in NSIS. If you succede , please tell me the script .
I executed applications,command lines, powershell expresions,shorcuts, batch and all are running , but i think is a problem with .ppkg in NSIS.
Please try to execute an .ppkg(Provisioning package) file in NSIS. If you succede , please tell me the script .
I executed applications,command lines, powershell expresions,shorcuts, batch and all are running , but i think is a problem with .ppkg in NSIS.
Ok, this time post the actual code that is failing, and then we can actually try to fix it.Originally Posted by Ycos3D View PostI use 'ppkg_path' just in this thread.
nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy Unrestricted -File "$INSTDIR\tempfile.ps1" '
in tempfile.ps1 ia have just 1 line : Invoke-Item "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\Upgrade_to_Enterprise.ppkg"
in tempfile.ps1 ia have just 1 line : Invoke-Item "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\Upgrade_to_Enterprise.ppkg"
Is not failing, but do nothing. ExeToStack return "success".Originally Posted by JasonFriday13 View PostOk, this time post the actual code that is failing, and then we can actually try to fix it.
Alright, so time to start checking that the paths are correct, $INSTDIR\tempfile.ps1 is first. Is tempfile.ps1 being extracted to $INSTDIR? Does the file exist when calling nsExec::ExecToStack? Then in tempfile.ps1 double-check that the path is correct and that it points to a file that exists.
the file exist, i used tempfile.ps1 to open a .txt file with same script.
in tempfile.ps1 i had just 1 line : Invoke-Item "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\test.txt"
For .txt file (.exe,.pdf and other extensions) works fine.
in tempfile.ps1 i had just 1 line : Invoke-Item "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\test.txt"
For .txt file (.exe,.pdf and other extensions) works fine.
If nsExec::ExecToStack is returning success, and it's working with other file types, then I would say that it's not a problem with NSIS. You might have to apply the file a different way, ie calling a proper tool to apply the file.
the powershell script : powershell -inputformat none -ExecutionPolicy Unrestricted -File "C:\Users\Ycos3D\Desktop\Provisioning OS deployment\tempfile.ps1" is working in "Windows Powershell" and the command : "C:\Windows\System32\provtool.exe" "<C:\Users\Ycos3D\Desktop\Provisioning OS deployment\packagename.ppkg>" is working in "Command prompt" but not working in NSIS
The ExecToStack return 0(succes) and the message is :
Invoke-Item : Application not found
At C:\Users\Ycos3D\Desktop\Provisioning OS deployment\tempfile.ps1:1 char:1
+ Invoke-Item "<ppkg path>"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( [Invoke-Item], Win32Exception
+ FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.P
owerShell.Commands.InvokeItemCommand
The ExecToStack return 0(succes) and the message is :
Invoke-Item : Application not found
At C:\Users\Ycos3D\Desktop\Provisioning OS deployment\tempfile.ps1:1 char:1
+ Invoke-Item "<ppkg path>"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( [Invoke-Item], Win32Exception
+ FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.P
owerShell.Commands.InvokeItemCommand
The problem is that i can't execute some files from $SYSDIR :changepk.exe , provtool.exe
Other files that require admin acces i can run.
I tryed ExecShell "runas" and UAC plugin, but with no result.
Other files that require admin acces i can run.
I tryed ExecShell "runas" and UAC plugin, but with no result.
Solved!
!include "x64.nsh"
${DisableX64FSRedirection}
nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy Unrestricted -File "$PLUGINSDIR\tempfile.ps1" '
${EnableX64FSRedirection}
!include "x64.nsh"
${DisableX64FSRedirection}
nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy Unrestricted -File "$PLUGINSDIR\tempfile.ps1" '
${EnableX64FSRedirection}