I have a two line Powershell script I want to run at the end of an MDT Task Sequence. I don't get an error, it just doesn't run. I've tried running the commands in a Powershell Task Sequence step and also as an Application. Here's what I need to run:
$Filelocation = "c:\OfflineJoinDomain\" + $env:computername + ".txt"
cmd /c Djoin.exe /requestodj /loadfile "$FileLocation" /windowspath %windir% /localos
Here is my Application command line: powershell.exe -ExecutionPolicy Bypass - File %DEPLOYROOT%\Applications\DJoin.ps1
I've also tried running it as a Command Line step:
Powershell.exe -ExecutionPolicy Bypass -Command "$Filelocation = 'c:\OfflineJoinDomain\' + $env:computername + '.txt'; cmd /c Djoin.exe /requestodj /loadfile '$FileLocation' /windowspath %windir% /localos"
Also, I've tried using %OSDComputerName% instead of $env:computername.
Any ideas?