Good afternoon all!
May I get some assistance, or at least pointed in the right direction with the below script?
Im working with the Dell BIOS and have successfully been able to get what we're looking for working as far as, getting the remote PC to set a certain category to Disabled, or Enabled. Now the issue is, when trying to create the script, the variable for the selection does pass through and just loops to the first colum of selections. See below:
$PSSession = New-PSSession -ComputerName $CName
Write-Host "Please wait will module is loaded"
Invoke-Command -Session $PSSession {Import-Module DellBIOSProvider}
Start-Sleep 1
$FConfigs = Invoke-Command -Session $PSSession { Get-ChildItem -path "DellSMBios:\" | Select-Object -ExpandProperty Category}
for ($i=0; $i -lt $FConfigs.Count; $i++) {
Write-Host "$($i): $($FConfigs[$i])"
}
$selection1 = Read-Host "Enter the number you'd like to change"
$selection = $Fconfigs[$selection1]
Start-Sleep 2
$SConfigs = Invoke-Command -Session $PSSession { Get-ChildItem -path "DellSMBios:\$selection" | Select-Object -ExpandProperty Category}
for ($i=0; $i -lt $SConfigs.Count; $i++) {
Write-Host "$($i): $($SConfigs[$i])"
}
$selection1 = Read-Host "Enter the number you'd like to change"
$selection = $Sconfigs[$selection1]
"$selection"
So in the selection of $FConfigs
, $selection
gets the appropriate selection but, it doesn't pass through to $SConfigs
. That's because, it shows the exact same selection of $FConfigs
in $Sconfigs
.
Please note: I have verified that whatever selection i choose, does have properties in it, so gci "dellsmbios:\$selection"
should work.
Hopefully this makes sense, and someone may be able to tell me what i may be doing wrong.