title: Run powershell from task sequence of MDT
body: <p>I have realised a powershell script who set the bios parameters during the intallion of windows 10 or windows 7 by MDT, I integrated it in my server MDT like a 'Run Powershell Script' from the task sequence of windows  but is not working, if I test my script in winpe is working well but after installation the os, if i chek the bios nothing is happen.
  I integrated my script by the os task sequence, right click in the task sequence, clic on add=>general=>run powershell, then I put the path and the name of my script like %SCRIPTROOT%myscript.ps1. For the execution policy i put it like "Run Command Line" it is : powershell.exe -command "Set-ExecutionPolicy Unrestrictebd".</p>
  
  <p>This is my script for windows 10, may be i miss something   </p>
  
  <pre><code>    $computerManufacturer = (Get-WmiObject win32_computersystem).manufacturer
  if($biosManufacturer -ceq "Dell Inc." -or $computerManufacturer -ceq "Dell Inc." ){
  
    #Activation du mode UEFI
          $bios= Get-WmiObject DCIM_BIOSService -namespace root\dcim\sysman 
          $bios.SetBIOSAttributes($null,$null,"Boot Mode","2")
          #Desactivation du legacy
          $bios.SetBIOSAttributes($null,$null,"Enable Legacy Option ROMs","1")
           #Activation du secure Boot
          $bios.SetBIOSAttributes($null,$null,"Secure Boot","2")     
  
           }
  </code></pre>
  
  <p>The second one for windows 7 is </p>
  
  <pre><code>$biosManufacturer = (Get-WmiObject win32_Bios).manufacturer
  $computerManufacturer = (Get-WmiObject win32_computersystem).manufacturer
  if($biosManufacturer -ceq "Dell Inc." -or $computerManufacturer -ceq "Dell Inc." ){   echo  $computerManufacturer
  
          #Desactivation du mode UEFI au detriment de Legacy
      $bios=Get-WmiObject -class DCIM_BIOSService -namespace root\dcim\sysman 
      $bios.SetBIOSAttributes($null,$null,"Enable Legacy Option ROMs","2")
      $bios.SetBIOSAttributes($null,$null,"Boot Mode","1")            
  
          #Desctivation du secure Boot
          #$bios.(Get-WmiObject DCIM_BIOSService -namespace root\dcim\sysman ).SetBIOSAttributes($null,$null,"Secure Boot","1")        
  
          } 
  
  elseif($computerManufacturer -ceq "HP" -or $computerManufacturer -ceq "Hewlett-Packard"  ){
  
   #Activation du mode UEFI du mode UEFI
      $bios=Get-WmiObject -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface
      $bios.SetBIOSSetting("Configure Legacy Support and Secure Boot", "Legacy Support Enable and Secure Boot Disable","")    
      $bios.SetBIOSSetting("UEFI Boot Options", "Disable","")
      $bios.SetBIOSSetting("Legacy Boot Options", "Enable","")
  
       }
  </code></pre>
  
  <p>If any one have any idea I will apreciate it!!</p>