Creating a script to gather PC information - to assist those asking for help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#151 Post by aGerman » 22 Sep 2016 10:33

Thanks elzooilogico!

Since XP is still a walking dead but PS wasn't available on some XP versions I would rather avoid to use PS.
The RunAs variable shall indicate whether or not the script was run with elevated administrative permissions (such as usually would be done via right clicking and selecting "Run as Administrator").

Perhaps I should simply leave out the additional registry check :?

Steffen

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#152 Post by aGerman » 23 Sep 2016 09:46

@foxidrive

Code: Select all

@echo off &setlocal
net session >nul 2>&1 && (ECHO set "RunAs=Yes") || (ECHO set "RunAs=No")
pause

Would you mind telling me if that works correctly on your Win8.1?

Steffen

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Creating a script to gather PC information - to assist those asking for help

#153 Post by foxidrive » 23 Sep 2016 09:50

aGerman wrote:Would you mind telling me if that works correctly on your Win8.1?

I see this:

Code: Select all

set "RunAs=Yes"
Press any key to continue . . .

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#154 Post by aGerman » 23 Sep 2016 12:52

Thanks! Er ... and that was with your origin settings or with the settings elzooilogico provided? (If I would have left out the redirections to NUL I would already know it :oops: )

Steffen

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Creating a script to gather PC information - to assist those asking for help

#155 Post by foxidrive » 23 Sep 2016 23:01

No worries. Now that the registry edit is in place it will stay there.

It's with the new setting that gives Elevated Admin=Yes

Code: Select all

 INFO.BAT version 1.2
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 6.3.9600]
Product name           :  Windows 8.1 Pro with Media Center, 32 bit
Performance indicators :  Processor Cores: 8      Visible RAM: 3390680 kilobytes

Date/Time format       :  (dd/mm/yy)  Sat 24/09/2016  15:04:06.32
__APPDIR__             :  C:\WINDOWS\system32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions             :  system: Enabled   user: Enabled
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-AU       Code Pages: OEM  850    ANSI 1252
DIR  format            :  24/09/2016  13:24     3,484,418,048 pagefile.sys
Permissions            :  Elevated Admin=Yes, Admin group=Yes


aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#156 Post by aGerman » 24 Sep 2016 03:57

Thanks foxidrive!
I will change the script. Relying on NET SESSION should be sufficient.

Steffen

thefeduke
Posts: 211
Joined: 05 Apr 2015 13:06
Location: MA South Shore, USA

Re: Creating a script to gather PC information - to assist those asking for help

#157 Post by thefeduke » 04 Jan 2017 17:29

I am just starting to put a newly acquired LattePanda Windows 10 mini-PC through its paces.
INFO.bat gave me an exception in the PATH:

Code: Select all

 INFO.BAT version 1.2
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 10.0.10586]
Product name           :  Windows 10 Home, 64 bit
Performance indicators :  Processor Cores: 4      Visible RAM: 4116580 kilobytes

Date/Time format       :  (mm/dd/yy)  Wed 01/04/2017  17:35:59.63
__APPDIR__             :  C:\WINDOWS\system32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions             :  system: Enabled   user: Enabled
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-US       Code Pages: OEM  437    ANSI 1252
DIR  format            :  01/04/2017  04:42 PM     1,476,395,008 pagefile.sys
Permissions            :  Elevated Admin=No, Admin group=Yes

                          Missing from the PATH environment: C:\WINDOWS\system32\WindowsPowerShell\v1.0
                          Missing from the tool collection:  debug

Actual Path            :  PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\

I added the full actual PATH manually.
I noticed a more current version and re-ran:

Code: Select all

 INFO.BAT version 1.3
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 10.0.10586]
Product name           :  Windows 10 Home, 64 bit
Performance indicators :  Processor Cores: 4      Visible RAM: 4116580 kilobytes

Date/Time format       :  (mm/dd/yy)  Wed 01/04/2017  18:01:37.47
__APPDIR__             :  C:\WINDOWS\system32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions             :  system: Enabled   user: Enabled
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-US       Code Pages: OEM  437    ANSI 1252
DIR  format            :  01/04/2017  04:42 PM     1,476,395,008 pagefile.sys
Permissions            :  Elevated Admin=No, Admin group=Yes

                          Missing from the PATH environment: C:\WINDOWS\system32\WindowsPowerShell\v1.0
                          Missing from the tool collection:  debug
I thought that the path was always terminated with a ";". Is this a problem for INFO.bat or for my system?

Thanks,
John A.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#158 Post by aGerman » 05 Jan 2017 12:35

Thank you John! Fixed with version 1.4.

Steffen

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: Creating a script to gather PC information - to assist those asking for help

#159 Post by miskox » 25 Jan 2021 02:02

Would it be useful to display the following info:
- windows language
- keyboard language settings

I mean: I have English Windows but I use Slovenian keyboard layout. Maybe this information might be useful.

Saso

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#160 Post by aGerman » 25 Jan 2021 09:22

I'm not sure, Saso. What unusual behavior are you facing with the settings you have? I mean, if that's rather unrelated to the execution of bach scripts, then we may not need this information.
(I just want to avoid gathering arbitrary information that are not even useful for our purpose. Keep in mind that we are asking users to publish their results in the forum. The script shall only help the volunteers in this forum to provide better help to the questioners.)

Steffen

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: Creating a script to gather PC information - to assist those asking for help

#161 Post by miskox » 26 Jan 2021 01:58

I thought of that based on this https://www.ghisler.ch/board/viewtopic.php?f=32&t=73738 .

I had a problem with copy/paste (as I see it internal copy/paste to Total Commander) when my national letters (ČŠŽ) were changed (not copied correctly) on one computer. I thought maybe this (English Windows XP, Slovenia keyboard layour and regional settings) could be the reason. That is why I proposed this. I don't think this would reveal any sensitive 'personal' information of the user executing info.bat (maybe location based on the language - but there are many countries with the same language so this might not be the case).

Thanks.
Saso

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#162 Post by aGerman » 26 Jan 2021 11:12

The locale name is already part of the collected information (even if the script doesn't seem to be able to find it on your XP machine). This is of interest because of the localized output of most of the commands. Also the output format of automatic variables like %date% is somewhat related. However, clipboard handling is a completely different story. I can't think of any problems that are related to problems with the behavior of Batch scripts. Handling clipboard data correctly is in the responsibily of the applications. And the keyboard layout is again a different story where I'm not even sure whether or not problems with the clipboard are somehow related. However, the keyboard layout is a can of worms. Not only that the behavior changed on Win8 onwards, applications are responsible to react properly to updates during runtime. Eventually we might not even be able to rely on those informations.

Steffen

atfon
Posts: 178
Joined: 06 Oct 2017 07:33

Re: Creating a script to gather PC information - to assist those asking for help

#163 Post by atfon » 08 Dec 2021 09:28

I noticed one small glitch on line 129:

Code: Select all

if not defined OEMCP for /f "tokens=*" %%i in ('%chcp%') do for %%j in (%%j) do set "OEMCP=%%~nj"
Shouldn't that be (%%i) as in:

Code: Select all

if not defined OEMCP for /f "tokens=*" %%i in ('%chcp%') do for %%j in (%%i) do set "OEMCP=%%~nj"

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Creating a script to gather PC information - to assist those asking for help

#164 Post by aGerman » 08 Dec 2021 15:12

What a silly typo :lol:
Update is published. Thanks!

Steffen

atfon
Posts: 178
Joined: 06 Oct 2017 07:33

Re: Creating a script to gather PC information - to assist those asking for help

#165 Post by atfon » 04 Apr 2022 06:51

I know this script takes into account whether WMIC is installed. However, are there plans to adjust it to account for the eventual removal of WMIC in Windows 11?

Post Reply