/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


Odd behaviour of powershell script in K1000

09/04/2020 221 views

I have an online kscript to check whether the boot loader is uefi or legacy bios. It creates a text file in a shared folder named for the pc and the result - bios or uefi. When I run the script manually, it works properly - my computer has uefi in the name. When I run it in kbox, all computers have bios in the name, including mine. I've tried running as system and with a saved admin credential (same one I used for the manual run), but still get bios for all.

Here's the script.

#Detect Legacy BIOS or UEFI

$PC = $env:COMPUTERNAME
$BL = bcdedit |findstr winload.efi

if (Test-Path "\\FS1\Logins\Computers\BootLoader\*$PC.txt")
{break}
else
{
if ($BL -ne $null)
{$PC | Out-File "\\FS1\BootLoader\uefi-$PC.txt" -append}

else

{$PC| Out-File "\\FS1\BootLoader\bios-$PC.txt" -append}
}

I appreciate any insights. If this is already in inventory somewhere and someone can point me to it, that would be great, too.

Thanks.

Answer Summary:
0 Comments   [ + ] Show comments

Comments


Answer Chosen by the Author

0

Most likely this is because of the KACE Agent running in 32 bit.

Try starting the script with cd c:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe

Answered 09/05/2020 by: torstenspitz
Yellow Belt

All Answers

0

Could try this function, since your method is borking in KACE.

https://gallery.technet.microsoft.com/scriptcenter/Determine-UEFI-or-Legacy-7dc79488



Answered 09/07/2020 by: rileyz
Red Belt

0

The sysnative path fixed it. I ran into that 8 or 10 months ago, so I need to tattoo on my forehead.

Thanks to both of you for the responses.

Answered 09/08/2020 by: tpr
2nd Degree Black Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ