Old 17th July 2016, 08:44   #1
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
Executing .ppkg

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
Ycos3D is offline   Reply With Quote
Old 17th July 2016, 12:15   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
Use the full path to the ppkg.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th July 2016, 12:23   #3
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
ppkg_path is the full path
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 07:25   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 902
Quote:
Originally Posted by Ycos3D View Post
I tryed ExecWait '"C:\Windows\System32\provtool.exe" "<ppkg_path.ppkg>" ' , nothing happening.
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.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th July 2016, 07:27   #5
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
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"
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 07:30   #6
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
Please try to execute an .ppkg(Provisioning package) file in NSIS.
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 07:40   #7
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 902
So have you tried it like this:
Quote:
Originally Posted by Ycos3D View Post
ExecWait '"C:\Windows\System32\provtool.exe" "<C:\Users\Ycos3D\Desktop\Provisioning OS deployment\packagename.ppkg>" '
Is 'ppkg_path' an environment variable? Also, for provtool.exe you should be using $SYSDIR instead of an absolute path.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th July 2016, 07:44   #8
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
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.
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 07:50   #9
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 902
Quote:
Originally Posted by Ycos3D View Post
I use 'ppkg_path' just in this thread.
Ok, this time post the actual code that is failing, and then we can actually try to fix it.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th July 2016, 08:03   #10
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
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"
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 08:05   #11
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
Quote:
Originally Posted by JasonFriday13 View Post
Ok, this time post the actual code that is failing, and then we can actually try to fix it.
Is not failing, but do nothing. ExeToStack return "success".
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 08:15   #12
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 902
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.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th July 2016, 08:18   #13
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
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.
Ycos3D is offline   Reply With Quote
Old 18th July 2016, 08:34   #14
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 902
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.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th July 2016, 08:37   #15
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
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
Ycos3D is offline   Reply With Quote
Old 19th July 2016, 19:54   #16
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
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.
Ycos3D is offline   Reply With Quote
Old 19th July 2016, 21:56   #17
Ycos3D
Junior Member
 
Join Date: Jul 2016
Posts: 11
Solved!

!include "x64.nsh"

${DisableX64FSRedirection}

nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy Unrestricted -File "$PLUGINSDIR\tempfile.ps1" '

${EnableX64FSRedirection}
Ycos3D is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump