VB Script
--
Questions
--
Followers
Top Experts
i have this line code:
psexec.exe -c -h \\computer C:\Temp\BiosConfigUtility.EXE /c spwd:"" /nspwd:""
this command line check the bios of remote computer and perform a password change with from empty to empty, i use it to verify if computer have password or not.
if the password is not empty, i get this message:
<BIOSCONFIG Version="2.14.0.8" Computername="computer" Date="2013/07/25" Time=
"14:56:39" UTC="2" >
<WARNING msg="Attempt to change the password, but correct password not provided.
" />
<Warning msg="BCU return value" real="10" translated="10" />
</BIOSCONFIG>
BiosConfigUtility.EXE exited on computer with error code 10.
if the password is allready empty, the command line will work and change password and get this message:
<BIOSCONFIG Version="2.14.0.8" Computername="computer" Date="2013/07/25" Time=
"15:06:38" UTC="2" >
<Warning msg="BCU return value" real="0" translated="0" />
</BIOSCONFIG>
BiosConfigUtility.EXE exited on computer with error code 0.
i need the script to get from txt file with 100 computer and check for every one.
and exeport a result in csv file in this form:
computer,result
computer1,Attempt to change the password, but correct password not provided
computer2,BCU return value" real="0" translated="0"
computer3,Attempt to change the password, but correct password not provided
.......
in result, i need to filter the result and display only one of this 2 result:
Attempt to change the password, but correct password not provided
or
BCU return value" real="0" translated="0"
thanks for help
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
(powershell, btw)
& psexec.exe -c -h \\computer C:\Temp\BiosConfigUtility.EXE /c spwd:"" /nspwd:"">output.txt
and then collect the text file and parse out the results
i think the results from that command probably land in \\computer\c$\windows\syst
we dont allow psexec where I am right now, so i cannot mock something up at this time... maybe one of the others has some past experience here
$results = @()
$str1 = 'Attempt to change the password, but correct password not provided'
$str2 = 'BCU return value" real="0" translated="0"'
foreach ($computer in (Get-Content computers.txt))
{
$results += c:\sysinternalssuite\psexec.exe -c -h \\$computer C:\Temp\BiosConfigUtility.EXE /c spwd:"" /nspwd:"" |
Where {$_ -match "^\<WARNING msg=(.+)(?: />|\.)$"} |
ForEach {$matches[1] | Where {$_ -match $str1 -or $_ -match $str2}} |
ForEach { New-Object PSObject -Property @{ Computer = $computer; result = $_ } }
}
$results | Export-CSV c:\temp\output.csv -notype






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
i will test and report.
thanks for help
@footech:
its work and do what i need, but i have a problem, if computer not respond (because its not power on, or other think), all script get error:
Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
At C:\temp\test\checkbios.ps1:11 char:22
+ $results | Export-CSV <<<< c:\temp\test\output.csv -notype
+ CategoryInfo : InvalidData: (:) [Export-Csv], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCommand
any solution? i think if possible, mark on csv that computer is power off.
thanks

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
$results = @()
$str1 = 'Attempt to change the password, but correct password not provided'
$str2 = 'BCU return value" real="0" translated="0"'
foreach ($computer in (Get-Content computers.txt))
{
If (Test-Connection $computer -count 1 -quiet)
{
$results += c:\sysinternalssuite\psexec.exe -c -h \\$computer C:\Temp\BiosConfigUtility.EXE /c spwd:"" /nspwd:"" |
Where {$_ -match "^\<WARNING msg=(.+)(?: />|\.)$"} |
ForEach {$matches[1] | Where {$_ -match $str1 -or $_ -match $str2}} |
ForEach { New-Object PSObject -Property @{ Computer = $computer; result = $_ } }
}
Else { $results += New-Object PSObject -Property @{ Computer = $computer; result = "Not responding" }
}
}
$results | Export-CSV c:\temp\output.csv -notype
at this time its work, but when i apply script for 2000 computers it have take 8 hours without complete, on screen it have stop on :
Starting PsExec service on computername1 .........
so i have exit the script, and the problem, all computer checked, i have nothing, i thing the result file will only showed after complete all computer?
no way to construct report file same time script run?
i have re test with only 500 computers and at the end i have this error, but the csv file seem to be good:
Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
At C:\temp\test\checkbios.ps1:16 char:22
+ $results | Export-CSV <<<< c:\temp\test\output.csv -notype
+ CategoryInfo : InvalidData: (:) [Export-Csv], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCommand
thanks






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
ok now i have a csv file when script is on.
but same time the script block on Starting PsExec service on computername...
its possible to make a timout of 20 second for exemple for every psexec command to be sure if not respond it can continue? after 20sec timout, in csv file the script register not responding.
thank you
I've heard that enabling the right firewall rules can make PsExec run faster. Try ensuring that the predefined rule "Remote Service Management (RPC)" is enabled.
psexec -n 30 <rest of the command>

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
@Subsun, thank you, i have already test with the -n option :)
VB Script
--
Questions
--
Followers
Top Experts
VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.