Anybody having simple method to capture the command prompt output? For example the below command gives me the BIOS serial number (This is required for security)
Code: Select all
wmic bios get serialnumber > sno.txt
Moderator: Rathinagiri
Code: Select all
wmic bios get serialnumber > sno.txt
Code: Select all
FUNCTION ParallelPortInfo()
LOCAL obj, oLocator, oWmi, oCollection
LOCAL cInfo := ""
oLocator := win_oleCreateObject( "wbemScripting.SwbemLocator" )
oWmi := oLocator:ConnectServer()
cInfo := PADL( 'Paralell Port:' , 16 ) + " " + "No hay Puerto Paralelo Físico..." + CRLF
oCollection:= oWMI:ExecQuery("Select * from Win32_ParallelPort") // <====================== Win32_Bios ???
For Each obj In oCollection
cInfo += PADL( 'Name:' , 16 ) + " " + obj:Name + CRLF
cInfo += PADL( 'Caption:' , 16 ) + " " + obj:Caption + CRLF
cInfo += PADL( 'Description:', 16 ) + " " + obj:Description + CRLF
// See Properties --------------- http://msdn.microsoft.com/en-us/library/aa394247(v=vs.85).aspx
Next
cInfo += REPLICATE( "_", 77 ) + CRLF
RETURN cInfo
Code: Select all
FUNCTION GetBiosSerialNumber()
LOCAL obj, oLocator, oWmi, oCollection
LOCAL cInfo := ""
oLocator := win_oleCreateObject( "wbemScripting.SwbemLocator" )
oWmi := oLocator:ConnectServer()
oCollection:= oWMI:ExecQuery("Select * from Win32_BIOS") // <====================== Win32_Bios ???
For Each obj In oCollection
cInfo := obj:SerialNumber
// See Properties --------------- http://msdn.microsoft.com/en-us/library/aa394247(v=vs.85).aspx
Next
RETURN cInfo
Code: Select all
Function main()
local cStdOut, oplist
hb_processRun( "cmd.exe /C start /b wmic bios get serialnumber",, @cStdOut )
Msginfo( "result:" + cStdOut)
HB_MEMOWRIT("Result.txt", cStdOut)
Return nil
There may be other solution:trmpluym wrote: ↑Sun Nov 18, 2018 11:10 am Somebody knows a way to do the same for PowerShell ?
So launch a PowerShell script and capture the resulting output ?
Maybe a C Guru knows how, here a starting point:
https://blogs.msdn.microsoft.com/kebab/ ... ts-from-c/
Code: Select all
// demo using power shell
Function main()
local cStdOut, oplist
hb_processRun( "powershell.exe -WindowStyle Hidden Get-WmiObject -Class Win32_BIOS ",, @cStdOut )
Msginfo( "result:" + cStdOut)
HB_MEMOWRIT("PS_Result.txt", cStdOut)
Return nil
Code: Select all
SMBIOSBIOSVersion : F8
Manufacturer : American Megatrends Inc.
Name : BIOS Date: 10/30/17 14:30:15 Ver: 05.0000C
SerialNumber : Default string
Version : ALASKA - 1072009