2

I am currently having trouble running powershell script within the unattend.xml file that I have. The powershell is supposed install applications, but the xml file can't seem to run the line for the script.

I have gone back and forth between using <FirstLogonCommands>, <RunSynchronousCommand>, and <SynchronousCommand>

<FirstLogonCommands>
   <SynchronousCommand wcm:action="add">
    <CommandLine>Powershell -ExecutionPolicy ByPass -File \\deploy\RemoteInstall\WdsClientUnattend\deploySoftware.ps1</CommandLine>
    <Description>Installs software</Description>
    <Order>1</Order>
   </SynchronousCommand>
</FirstLogonCommands>

This command is supposed run the ps1 script that installs applications from our server.

3
  • What does "can't seem to run the line for the script" mean? Are you getting an error message? (Remember: We can't see your screen.) Commented Jul 3, 2019 at 17:56
  • According to the setuperr log, it says that it is having issues running the FirstLogonCommands. The description given is that "The setting is not defined in this context." Commented Jul 3, 2019 at 18:20
  • Update your question with all the errors you are getting. Commented Jul 3, 2019 at 19:11

1 Answer 1

2

I'm not sure what the problem is, but if it's not necessary to have the command in the autounattend.xml file, I'd suggest you try putting the command in \sources\$OEM$\$$\Setup\Scripts\SetupComplete.cmd file.

Make the cmd file first with the powershell command, like this

PowerShell.exe /W Normal -ExecutionPolicy Bypass ...

then test if it works correctly by running it manually. If it does, put it in the above mentioned directory and try installing windows again.

Sign up to request clarification or add additional context in comments.

4 Comments

I was hoping to use the powerhsell in the unattend.xml file so that upon logging in, the application would already be installed. The powershell works aside from it not not running .msi and .bat files silently.
Whatever you put in the SetupComplete.cmd file also completes before the user logs in.
@hextech What is the /W switch for?
/W stands for -WindowStyle. Valid values are Normal, Minimized, Maximized and Hidden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.