/build/static/layout/Breadcrumb_cap_w.png
06/28/2019 185 views

I have a post install task that runs a powershell script to import the .xml file for the start menu and taskbar layout but it continually fails.

Has anyone else been able to get this to work?


Import-StartLayout -LayoutPath "$PSScriptRoot\StartTaskLayout.xml" -MountPath -C:\
1 Comment   [ + ] Show comment

Comments

  • Also post the Error Message and return code when a task fails

All Answers

0

Are you zipping the xml and ps1 files together and adding those to a post application task?

For the app task command use

powershell -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file script.ps1




Answered 06/28/2019 by: SMal.tmcc
Red Belt

  • Yes, they are zipped together.
    • it the powershell at least ver 3.0
    • This content is currently hidden from public view.
      Reason: Removed by member request For more information, visit our FAQ's.
  • Just went thru the files myself on a test, the command that way is looking for PS in the kace application directory vs the system area


    this command powershell -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file script.ps1 the xml looks like this

    <Task ID="1162">
    <Name>powershell example</Name>
    <WorkingDirectory>%systemdrive%\KACE\Applications\1162</WorkingDirectory>
    <CommandLine><![CDATA["%systemdrive%\KACE\Applications\1162\powershell -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file script.ps1" ]]></CommandLine>
    <Parameters></Parameters>
    <PostTaskAction>None</PostTaskAction>
    <KACETaskType>Application</KACETaskType>
    <FileType>Exe</FileType>
    <Type>PO</Type>
    <Guid>15d167da1da2d1</Guid>
    </Task>
    note the command line:

    Use this command for the task:

    %systemdrive%\%sysnative%\WindowsPowerShell\v1.0\powershell -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file script.ps1

    the task then looks like this:

    <Task ID="1162">
    <Name>powershell example</Name>
    <WorkingDirectory>%systemdrive%\KACE\Applications\1162</WorkingDirectory>
    <CommandLine><![CDATA[%systemdrive%\%sysnative%\WindowsPowerShell\v1.0\powershell -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file script.ps1]]></CommandLine>
    <Parameters></Parameters>
    <PostTaskAction>None</PostTaskAction>
    <KACETaskType>Application</KACETaskType>
    <FileType>Exe</FileType>
    <Type>PO</Type>
    <Guid>15d167d1570e71</Guid>
    </Task>
    • To check how it's formatted lets look at the Task xml for that deployment. have your browser at the list page of your deployments. point your mouse at the deployment with this task. look at lower left corner of your browser and note the system ID. Next go the library and do same thing for task.

      connect to your \\ikbox\peinst share using .\admin samba password.

      under peinst you will find a directory "scripts"

      In that dir find the deployment_Tasks_###.xml that matches the id number to the number in the name.

      Edit that file and search for the matching task ID and post that part

      for example for a task with ID 1114

      Task ID="1114">
      <Name>Acad W10 copy w2d files</Name>
      <WorkingDirectory>%systemdrive%\KACE\Applications\1114</WorkingDirectory>
      <CommandLine><![CDATA["%systemdrive%\KACE\Applications\1114\xcopyacadfiles.exe" ]]></CommandLine>
      <Parameters></Parameters>
      <PostTaskAction>None</PostTaskAction>
      <KACETaskType>Application</KACETaskType>
      <FileType>Exe</FileType>
      <Type>PO</Type>
      <Guid>15d14f784b689e</Guid>
      </Task>

      next on the ikbox navigate to applications\task_id###
      do dir and you should see your zip and a sub contents dir. change to contents dir and make sure your files are there
  • I do something similar on my images. I use a bat file to copy the XML Layout to the directory. Both files are zipped together. Then I call the bat file in the command line.

    @echo off
    xcopy LayoutModification.xml /y C:\Users\Default\AppData\Local\Microsoft\Windows\Shell