Page 1 of 3 123 LastLast
Results 1 to 15 of 41
  1. #1
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,980
    Thanks
    424
    Thanked 1,601 Times in 1,451 Posts

    Introducing CMsLocalPCInfo

    Hey Y'all,

    I've pulled out enough hair trying to get my PC Information program to work across networks, other than mine, (don't know if I'll ever understand PS-Session trouble shooting) that I decided to make a version for just the Local PC. I've stripped all the Remote Session code and made a few more error traps so it's ready for testing for those brave souls out there.

    CMsLocalPCInfo.ps1: Code removed latest code at the bottom of thread.

    If you're interested in the original thread you can find it here.

    HTH
    Last edited by RetiredGeek; 2017-03-08 at 22:45.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  2. #2
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    2,059
    Thanks
    164
    Thanked 194 Times in 187 Posts
    Well I'm sorry RG



    It worked!

    Hopefully someone will spot the problem with the network one - or you'll have a Eureka moment, almost certainly when you're writing another script!

    Now to think of something I can write in Powershell which is a bit more than just 'Hello World!'

    Thanks for all your hard work on this.
    What do you mean nothing is impossible? I've been doing nothing for years.

  3. #3
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    2,059
    Thanks
    164
    Thanked 194 Times in 187 Posts
    Hi RG, can I make a suggestion or two please? When saving to a file, there's no obvious date so I think that would be useful, either as part of the name, or at the top of the file. Now for something a bit more controversial , could the date format copy the date format in the PC please. That means that we have the date in dd/mm/yyyyy format in our benighted part of the world, and others can have the date in their own format. Failing that perhaps dates should always be yyyymmdd. Perhaps others can add their preferences here. I note that dates further down the file are in yyyymmdd format and that's great.

    And I forgot to add something in my first post:

    Last edited by access-mdb; 2017-03-07 at 08:55. Reason: A bit more info
    What do you mean nothing is impossible? I've been doing nothing for years.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Fort McMurray, Alberta, Canada
    Posts
    720
    Thanks
    73
    Thanked 99 Times in 92 Posts
    Don't know about you RG, but I don't have enough hair to spare!



    As to the date formatting, I have a lot of experience with this. Not much wisdom but a lot of experience!

    Well, OK, maybe a little wisdom? If dates are going to be sorted, sequenced, or selected upon, really they need to be in YYYYMMDD order. The reasons are fundamental. That puts the dates into Most Significant Digits On The Left order. This is how Arabic numbers work and Arabic numbers replaced Roman numbers for this reason.

    Presentation is another matter. Presentation can use local cultural standards for ease of use and understanding. And this is how almost all software works. Internally, dates are always stored YYYYMMDD, but upon presentation they get converted to the local date formats.

    Thus I put it to you. Is the output of CMsLocalPCInfo.ps1 meant to be a data store, like a database? Or is it an output, like a report, for human consumption? I have an opinion on that matter but I'll withhold that opinion pending the author's comment.

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,980
    Thanks
    424
    Thanked 1,601 Times in 1,451 Posts
    Access & B,

    "Just tryin' to keep the customer satisfied..."


    So the file's are now named like this: CMsLocalPCInfoV01-01 as of 20170307. (YYYYMMDD)

    The header in the file is now:
    Computer Mentor's Local System Information
    Version 01-01 as of: 3-7-2017 (this should be in Local format...needs testing Access).

    Hope this keeps everyone happy? As I remember I got into the whole make it work over the network thing as a suggestion posted here.

    CMsLocalPCInfoV01-01: Code removed latest code at the bottom of thread.

    HTH
    Last edited by RetiredGeek; 2017-03-08 at 22:45.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. #6
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    2,059
    Thanks
    164
    Thanked 194 Times in 187 Posts
    The dates look fine other than in the windows section:
    System Root C:\WINDOWS
    Install Date 08/05/2016 17:14:39
    Date/Time 03/08/2017 13:21:00
    Last Boot 03/03/2017 08:02:21 Cold boot from full shutdown
    Up Time (5 05:18:39 2337560[0]) Day(s) (5 05:18:39 2337560...
    I assume they're in US format, rather than the date is 3rd August 2017! All the other dates seem to be yyyymmdd or in the local format.

    Thanks for putting up with us!
    What do you mean nothing is impossible? I've been doing nothing for years.

  7. #7
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,980
    Thanks
    424
    Thanked 1,601 Times in 1,451 Posts
    Access,

    Ok, here's a revised version that should show all the dates in the Windows section in your local format.

    I did not attempt to change the dates in the Installed Programs section as they are reported as yyyymmdd or universal.

    Revised CMsLocalPCInfo: Code removed latest code at the bottom of thread.

    Let me know if it tests out?

    HTH
    Last edited by RetiredGeek; 2017-03-08 at 22:44.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  8. #8
    Administrator Rick Corbett's Avatar
    Join Date
    Dec 2009
    Location
    South Glos., UK
    Posts
    3,464
    Thanks
    154
    Thanked 943 Times in 758 Posts
    Hi RG,

    It was a bit fiddly to get working but very impressive! Obviously a labour of love, despite the hair-pulling.

    By 'fiddly', I mean that I had to update PowerShell as mine was the default v2 then I had to configure WinRM.

    WinRM2.png
    Click to enlarge

    A couple of observations:

    My boot drive is C:, not F:. I'm not sure why this was misdiagnosed.
    rg1.png
    Click to enlarge

    The top line spacing is a bit inconsistent between tabs. On some tabs the text appears at the top of the display window, on others it appears there's one or more blank lines before the text appears. For example, the Installed Programs tab looks like there's 2 blank lines added before the text appears (1). I also wondered whether there should be text following BasePath: \ (2) and there's data missing from the Install Path (3)
    rg3.png
    Click to enlarge

    If you run the program using the x86 version of the Windows PowerShell ISE then the key isn't decrypted correctly so the wrong result is displayed but everything is fine using the x64 version.

    I don't understand why it wasn't able to determine the last boot time or whether the OS was compacted. However, I noted the following error was logged:
    Get-WinEvent : No events were found that match the specified selection criteria.
    At C:\Temp\CMsLocalPCInfo\CMsLocalPCInfo.ps1:1309 char:13
    + $Events = Get-WinEvent @GWEArgs
    + ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: ( : ) [Get-WinEvent], Exception
    + FullyQualifiedErrorId : NoMatchingEventsFound,Microsoft.PowerShell.Command s.GetWinEventCommand
    Also in terms of consistency, perhaps use either UNKNOWN or Unknown, but not both?
    rg5.png
    Click to enlarge

    "Pizza Box" and "Lunch Box"... are these real enclosure names?

    I spotted a number of typos:
    line 165 - privledges
    line 434 - DisAbled
    line 505 - monitor of if
    line 509 - HKLMlk\
    line 525 - Linear Fame Buffer (Frame?)
    line 739 - effective Resolution (why capitalised?)
    line 879 - Partiton
    line 996 - None-Avaliable
    line 1778 - HKLM:SYSTEM (should this be HKLM:\SYSTEM like line 1763?)
    line 2087 - mWhr (I could be wrong but isn't this Mwh?)
    line 2268 - Siddawy
    line 2310 - complied
    line 2614 - Siddawy
    line 2958 - Working (why capitalised?)
    line 2972 - Prior (why capitalised?)
    line 3002 - Privleges
    line 3017 - Please upgrade our PowerShell (your?)

    Hope this helps...

    EDIT: Sorry, I should have let you know beforehand... I'm using Windows 7 Pro SP1 x64.
    Last edited by Rick Corbett; 2017-03-08 at 11:13.

  9. #9
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    2,059
    Thanks
    164
    Thanked 194 Times in 187 Posts
    Hi RG, the dates in the Windows section are still US format. I did say the other dates were fine btw. I think it's fine to leave as is, especially as the date at the top is in the correct format. I haven't checked every line, but I assume the real data is correct (well the few bits I've looked at are correct) and that's the most important.
    Thanks for your patience!
    What do you mean nothing is impossible? I've been doing nothing for years.

  10. #10
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,980
    Thanks
    424
    Thanked 1,601 Times in 1,451 Posts
    Access,

    I hope you appreciate how much new stuff you made me learn about Window versions and PowerShell today!

    Well I think I finally have the dates the way you want them however, personally, I don't like them because of the lack of leading zeros in months and days but that's the way the Culture settings return the formats for ShortDate and ShortTime and they even come back different in Win 10 vs Win 7! BTW I also fixed the date display for the BIOS date on the Hardware tab.

    I've also fixed the problem with the Last Boot Time in Win 7 (stored in a different log file) and removed the Compacted OS line if it is not Win 10 (new feature w/10).

    So here's the latest version with those fixes and I also cleaned up some other stuff and all of Rick's suggestions. BTW Rick there is nothing wrong with the Installed programs that first section is programs installed in the Root directory or ones that didn't include the install path in the uninstall information.

    For testing I use my Dell Laptop w/Dual Boot Win 7HP set to en-gb and W10 Home set to en-us. Wish I'd thought of that sooner!

    Code:
    ---      Windows      ---    
    
    Item                      Value                                                
    ------                    -----                                                
    OS Name                   Microsoft Windows 7 Home Premium                     
       Version                6.1.7601                                             
       Bit-Width              64-bit                                               
       Key                    XXXXX-XXXXX-XXXXX-XXXXX-XXXXX                        
       Registered Owner       RetiredGeek                                                
       Registered Org                                                              
       System Root            C:\Windows                                           
       Install Date           03/08/2012 05:53                                     
       Date/Time              08/03/2017 20:05                                     
       Last Boot              08/03/2017 18:08                                     
       Up Time                01:41:30
    Code:
    ---      Windows      ---    
    
    Item                      Value                                                
    ------                    -----                                                
    OS Name                   Microsoft Windows 10 Home                            
       Version                10.0.14393                                           
       Bit-Width              64-bit                                               
       Key                    XXXXX-XXXXX-XXXXX-XXXXX-XXXXX                        
       Registered Owner       RetiredGeek                                    
       Registered Org         Computer Mentor LLC                                  
       System Root            C:\WINDOWS                                           
       Install Date           8/3/2016 5:21 PM                                     
       Date/Time              3/8/2017 8:13 PM                                     
       Last Boot              3/8/2017 8:10 PM Cold boot from full shutdown        
       Up Time                00:02:57                                             
       OS Compacted           True
    Revised CMsLocalPCInfo: Code removed latest code at the bottom of thread.

    HTH
    Last edited by RetiredGeek; 2017-03-10 at 12:14.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  11. #11
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    2,059
    Thanks
    164
    Thanked 194 Times in 187 Posts
    Quote Originally Posted by RetiredGeek View Post
    Access,

    I hope you appreciate how much new stuff you made me learn about Window versions and PowerShell today!
    Glad to keep you busy RG!

    Interestingly, this is what I gate in my Windows section

    Code:
    ---      Windows      ---    
    
    Item                      Value                                                
    ------                    -----                                                
    OS Name                   Microsoft Windows 10 Pro                             
       Version                10.0.14393                                           
       Bit-Width              64-bit                                               
       Key                    summat or other                        
       Registered Owner       Malcolm                                              
       Registered Org                                                              
       System Root            C:\WINDOWS                                           
       Install Date           05/08/2016 17:14                                     
       Date/Time              09/03/2017 09:40                                     
       Last Boot              03/03/2017 08:02 Cold boot from full shutdown        
       Up Time                (6 01:38:13 5617560[0]) Day(s) (Get-Date (6 01:38:...
    So I get the leading zeroes - go figure (no don't figure, leave as is!)

    One question though, the up time in yours is just a straight time but in mine it's that long string. Is this because yours is just hh:mm:ss and mine is days as well? This isn't a request for a change as it's obvious my uptime is 6 days, 1 hour 38 minutes and 13 seconds.
    What do you mean nothing is impossible? I've been doing nothing for years.

  12. #12
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,980
    Thanks
    424
    Thanked 1,601 Times in 1,451 Posts
    Access,

    As I stared the Short date format returned for W7 is different than that returned for W10, unfortunately I don't have W8 to test.

    The code should account for the days in Uptime, guess I'll have to leave my computers on over night to work on that.

    Thanks for testing!
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  13. #13
    Administrator Rick Corbett's Avatar
    Join Date
    Dec 2009
    Location
    South Glos., UK
    Posts
    3,464
    Thanks
    154
    Thanked 943 Times in 758 Posts
    Hi RG,

    Using the latest version, the Storage tab still showed my boot drive as F: instead of C:. Then I realised that my F: drive, used solely for data storage, showed as 'active' in Disk Management. I have no idea why, as I cannot remember ever using it as a system drive. Anyway, I used diskpart to remove the active flag, rebooted and ran your script again.... and still C: doesn't show up as Boot (but does if I run a WMI query using Win32_DiskPartition). Any idea?

    rg6.png
    Click to enlarge

    I noticed something weird with the logfile. If I open it with Notepad it looks like the top 2 lines are concatenated but if I open it in Notepad ++ they show as 2 lines:

    weird.png
    Click to enlarge

    Couple more typos:
    line 289 - Working (why capitalised?)
    line 819 - SPeed/RPMs

  14. #14
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Fort McMurray, Alberta, Canada
    Posts
    720
    Thanks
    73
    Thanked 99 Times in 92 Posts
    Random thoughts:

    Pizza box enclosure: Haven't heard this term since the Sun workstation days.
    Lunch box enclosure: Haven't heard this term before, but Lenovo makes some mini-system boxes that are approximately lunchbox size?

    Logfile presentation differences in NotePad vs. NotePad++: Could it be this is the old Unix vs. Microsoft line termination thing? Microsoft always uses CR+LF, Unix always uses LF only.

  15. #15
    Administrator Rick Corbett's Avatar
    Join Date
    Dec 2009
    Location
    South Glos., UK
    Posts
    3,464
    Thanks
    154
    Thanked 943 Times in 758 Posts
    Quote Originally Posted by BHarder
    Logfile presentation differences in NotePad vs. NotePad++: Could it be this is the old Unix vs. Microsoft line termination thing? Microsoft always uses CR+LF, Unix always uses LF only.
    I had to look it up... PowerShell uses `n as a line feed character but Notepad expects linebreaks to be encoded as `r`n. So, in RG's code (line 2921), Notepad concatenates it.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •