-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor issue running powershell scripts #71
Comments
Hello, Thank you for the spotting of this issue and the details/fix provided, will communicate them to the team for further check and fix. |
Hi, <step type="BDD_RunPowerShellAction" name="Upload-PSDLogs" description="" disable="false" continueOnError="true" successCodeList="0 3010">
<defaultVarList>
<variable name="ScriptName" property="ScriptName">%SCRIPTROOT%\Upload-PSDLogs.ps1</variable>
<variable name="Parameters" property="Parameters"></variable>
<variable name="PackageID" property="PackageID"></variable>
</defaultVarList>
<action>cscript.exe "%SCRIPTROOT%\ZTIPowerShell.wsf</action>
</step> |
Hi @ASlowTurtle, From what I understand, you need to add the following for each "Run PowerShell Script" step in the PowerShell script command box: <step type="BDD_RunPowerShellAction" name="Upload-PSDLogs" description="" disable="false" continueOnError="true" successCodeList="0 3010">
<defaultVarList>
<variable name="ScriptName" property="ScriptName">powershell.exe -file %SCRIPTROOT%\Upload-PSDLogs.ps1</variable>
<variable name="Parameters" property="Parameters"></variable>
<variable name="PackageID" property="PackageID"></variable>
</defaultVarList>
<action>cscript.exe "%SCRIPTROOT%\ZTIPowerShell.wsf</action>
</step> As I said earlier, I will bring this to attention to the team in our next meeting. |
Hey @GeoSimos
However, your suggestion would have worked if I did use the "Run Commad Line" instead of "Run PowerShell Script" step. What will work in the current version is this (using <step type="BDD_RunPowerShellAction" name="Upload-PSDLogs" description="" disable="false" continueOnError="true" successCodeList="0 3010">
<defaultVarList>
<variable name="ScriptName" property="ScriptName">Upload-PSDLogs.ps1</variable>
<variable name="Parameters" property="Parameters"></variable>
<variable name="PackageID" property="PackageID"></variable>
</defaultVarList>
<action>cscript.exe "%SCRIPTROOT%\ZTIPowerShell.wsf</action>
</step> The old way (how it was done in MDT) however doesn't work in the current version: <step type="BDD_RunPowerShellAction" name="Upload-PSDLogs" description="" disable="false" continueOnError="true" successCodeList="0 3010">
<defaultVarList>
<variable name="ScriptName" property="ScriptName">%SCRIPTROOT%\Upload-PSDLogs.ps1</variable>
<variable name="Parameters" property="Parameters"></variable>
<variable name="PackageID" property="PackageID"></variable>
</defaultVarList>
<action>cscript.exe "%SCRIPTROOT%\ZTIPowerShell.wsf</action>
</step> The only difference between those two is |
Hi @ASlowTurtle, Thank you for your detailed report, it helps a lot to fix issues. Kind regards |
The PowerShell step in the task sequence (which utilises PSDPowershell.ps1) opens a blank powershell window instead of executing the script. This happens only if a full path is specified instead of a simple file name.
The format
%SCRIPTROOT%\Upload-PSDLogs.ps1
won't work (butUpload-PSDLogs.ps1
should work).This is a minor issue (it works if I provide the file name instead of the full path). However, most if not all examples on using scripts in MDT will use
%SCRIPTROOT\
in front of the script name. It also can be confusing because executing scripts using cmd will require the full path.The about
About to run:
line expands an empty variable.I did a minor change to PSDPowershell.ps1 to line 53:
Adding another
split-path -Leaf -Path ...
This way it doesn't matter in which format the path is provided and
Find-PSDFile
can provide the path.The text was updated successfully, but these errors were encountered: