How to execute powershell scripts from MDT?

cn flag

I have created MDT environment with PSD Extension by following these steps.

There is a default step for running a powershell script(Configure).


I duplicated that and created Configure1. configure1

And created a script in DeploymentShare scripts folder. scripts

Just added below content to the powershell script I created.

Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

But it seems, the above content is not applied on the machine after task sequence.

Please suggest how to execute the powershell scripts.

sg flag

It could be because of execution policy.

Try this:

 %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Noninteractive -Executionpolicy bypass -Noprofile -File {pathToFile.ps1}
Sara June avatar
cn flag
Still same, it is not executing
Sara June avatar
cn flag
It seems it is executed only if I keep in custo taks section.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.