I wrote this script to run a command on all of the computers in the Computers.txt file to update the bios using the HP bios utility. it looks like its not running the names from the txt and i just don't know what to do anymore...
$targets = Get-Content '\\52gkux-fs-001v\FRD-Admins\SCOO\03 - Scripts\Bazooka Blast\Targets\Computers.txt'
#List of computers to target
ForEach ($Computer in $targets){
#loops through each computer in your computer list
if (Test-Connection $computer -count 1 -Quiet )
{
Invoke-Expression -Command "\\52gkux-hc-001v\LogonScripts\Modules\BIOS\sp93030\BiosConfigUtility.exe /set:\\52gkux-hc-001v\LogonScripts\Modules\BIOS\sp93030\hpBios.txt /cspwdfile:\\52gkux-hc-001v\LogonScripts\Modules\BIOS\sp93030\password.bin /log"
}
else #means we had a bad ping
{
#Report the reason for the bad ping based on WMI ping error code
if ($reply.statuscode -eq $null) #null status code means no DNS entry was found. Delete that shit from ADUC (unless it's the three-star's laptop...)
{
$PingResponse = "No DNS Entry"
$pingIPaddress = $null
}
#Report the reason for the bad ping based on WMI ping error code
if ($reply.statuscode -eq "11010")
{
#Ping timeouts still return the IP address from DNS
$pingIPaddress = $reply.IPV4Address.ipaddresstostring
$PingResponse = "Request Timed Out"
}
#Report the reason for the bad ping based on WMI ping error code
if ($reply.statuscode -eq "11003")
{
$pingIPaddress = $reply.IPV4Address.ipaddresstostring
$PingResponse = "Unable to reach host"
}
}
$ResultProps = @{
ComputerName = $strComputer
PingResponse = $PingResponse
ErrorCode = $ReturnCode
}
$return = New-Object PSObject -Property $ResultProps
return $return
}