I am new to MDT and need to add following jobs in to the task sequences
1)enable bit locker
2)Ask for a computer name
3)Run a script in powershell
I am able to capture and deploy reference image with no problem but just need to know how to add these jobs in to the task sequences
and need some assistances please
Windows OS
Last Comment
wajhiuddin
8/22/2022 - Mon
aravind anche
You can do all these in custom settings
right click deployment share> properties> rules
for computer name
SkipComputerName=NO
For powershell script
Add it in task sequence
Double click the TS
on task sequence tab
select after which step you want to run the script highlight it >Add>genearal>run powershell script
To run a powwershell script I now there is an option to run but I don't know what to put in to the box
Power Sheill Scirpt and parameters. ??
I have a .ps1 which I want to run ?
aravind anche
Where is is power shell script?
Is it in the script folder of deployment share?
If so
in power shell script column of TS which is image
"PowerShell.exe -File "%SCRIPTROOT%\yourfilename.ps1"
Also what is purpose of the script, some scripts need to have execution policy bypass
"PowerShell.exe -File "%SCRIPTROOT%\yourfilename.ps1"
Are "on right place ?
aravind anche
Did that work?
wajhiuddin
ASKER
haven't tried yet , I just want to make sure it's correct, there are three qutations (") in the whole string of command and I wanted to make sure it's correct. I have to deploy the image and then see if script runs . which will take soem time probably about 40 minitues.
Adding this command "PowerShell.exe -File "%SCRIPTROOT%\yourfilename.ps1"
I get an erorr messag "The run powershell Script action has error that mus tbe resolved.....?
Deployment was failed because script failed.
It runs perfectly fine when I had just %ScriptRoot%\yourfile.ps1
it just had policy restricted I ran another PowerShell script right before my script with following command
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -force
It has to be run as admin but looks like Task Sequence is not running this command as an admin.
My script rans(it creartes a folder "Temp") but not successful because policy was still restricted?
Please see my script which runs absolutely fine with unrestricted policy
So the problem I have I can't have PowerShell run as unrestricted
Thanks ProtTest.ps1.txt
wajhiuddin
ASKER
the error I have is Unable to locate script powershell -NoProfile-ExecutionPolicy Bypass-file
aravind anche
Can you try running
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
right click deployment share> properties> rules
for computer name
SkipComputerName=NO
For powershell script
Add it in task sequence
Double click the TS
on task sequence tab
select after which step you want to run the script highlight it >Add>genearal>run powershell script
For enable bitlocker
follow the below link
http://eddiejackson.net/wp/?p=11333
https://community.spiceworks.com/how_to/112239-enable-bitlocker-during-mdt-deployment-non-domain