-1

I'm verry beginer in powershell, I'm wonking in a project, the goal it's to set the Biossetting like disabling or enabling the secureBoot and UEFI mode, while installing windows 7 or 10 by MDT. I'm working with Dell and hp computer, I have the script for setting the bios of hp or dell

Hp: $bios=Get-WmiObject -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface $bios.SetBIOSSetting("UEFI Boot Options", "Enable","")

Dell:

(Get-WmiObject DCIM_BIOSService -namespace root\dcim\sysman -ComputerName .).SetBIOSAttributes($null,$null,"Secure Boot","1")

Then, my first problem these command is not working in any computer I need to install some modules, some cmdlet from hp or dell website, I want to know if make my script ".exe", it's gonna work in every-computer ? Because I need to run my script with with deployement of windows. My second and difficult task, I want to know with variable task sequence to use in my script, to detect the os of the tasksequence, I find this code in internet, after too much research in internet

$TaskPath = "$($MdtDrive):\Task Sequences" $ControlPath = "$MDtroot\Control" $OSPath = "$($MdtDrive):\Operating Systems" $OS = (Get-ChildItem -Path $OSPath | Out-GridView -PassThru -Title "Select required OperatingSystem").Name This code detect if the OS of the task sequence I want install in my computer is windos 7 or windows 10?

Thanks !

Khalfe
  • 15
  • 2
  • 8
  • 1
    Hi, 1. your question should be splitted in simpler questions (and posted separately) 2. you shouldn't drop some code *found on the net* here and expect people to explain what it does – sodawillow May 11 '17 at 20:55

2 Answers2

0

If I recall correctly from my days of systems deployment, Dell and HP both make dedicated tools for settigns BIOS configuration. Just make sure you run it in WinPE. Depending on which BIOS settings you change you make even have to boot WinPE twice to make sure the OS installs the way you want.

Dell: http://en.community.dell.com/techcenter/enterprise-client/w/wiki/7532.dell-command-configure

HP: https://deploymentbunny.com/2010/10/18/enable-tpm-via-task-sequence-on-hp-boxes/

Although it is definitely possible to make these settings in WMI I would only look to it as a last resort. Windows has to be compatible with every piece of hardware, whereas Dell/HP tools are targeted at their systems. It's like using a scalpel vs a Swiss army knife.

0

I have some difficults I’m working in a script who set the bios configuration while installing windows 7 or 10 by MDT, then my first question is: Wich variable I can use to identify the os of the new task sequence I mean the current os the mdt preparing to install in the computer after the user select the os during the installation. I’m wondering if this code doying the job

$OS = Get-ChildItem -Path $OSPath | Out-GridView -PassThru -Title “Select required OperatingSystem”
$OSPath = “$($MdtDrive):\Operating Systems”
Khalfe
  • 15
  • 2
  • 8
  • First thing is that your lines are out of order. Line 1 calls $OSPath which is specified in line 2, so move that up. Second thing is this is just going to display a pretty output of all folders/files one layer deep on $OSPath. There is no allowing user input in the way this script is written. If all you want to do is get the Operating System version you should use something like: (Get-CimInstance Win32_OperatingSystem).version with some If statements. – Michael Timmerman May 12 '17 at 23:15
  • Thanks Michael Timmerman, after posting my message I realise that the two is not in order. (Get-CimInstance Win32_OperatingSystem).version, this command give me just the os of the computer, while I want the os of the tasksequence, I mean the os of the MDT preparing to install in the computer after the user choose the task in the mdt wizard during the installation. – Khalfe May 16 '17 at 14:10
  • So you are trying to get the WinPE version? Or trying fetch the details of the selected MDT task sequence, including the OS version to be installed? If it is the latter, then you need to be looking more into how the backends of MDT work before you look at how to script it. – Michael Timmerman May 20 '17 at 14:59
  • Thanks, I'm trying to get the os of the task sequence to be installed. – Khalfe May 22 '17 at 19:19
  • Thanks, I'm trying to get the os of the task sequence to be installed. But now I changed my strategie, I have two os task windows 7 and windows 10, and I have the script for windows 7 and the script for windows 10, I have integrated every code in his task, like the task for windows 10 I inetgrated the sript powershell who set the secure boot on enable but is not working. – Khalfe May 22 '17 at 19:31