2020-07-16

Windows 10 Settings Gear Icon hangs after 1909 Update

Windows 10 Settings Gear Icon hangs after 1909 Update.  Resolved.

Symptoms:

  • After Windows 10 1909 Update
  • Clicking the Windows Gear Icon (Settings icon), Settings hangs / freezes / stays on the gear-banner screen.  Windows Settings screen, with Windows Update & Security does not load

Solution:

1.  From Start Menu Search, type "CMD.exe"
     Right-mouse click "Windows Command", select "Run as Administrator"

2.  At the DOS Prompt, type this command:

  DISM.exe  /online /cleanup-image /scanhealth

3.  When that command completes, run this command from the same administrative prompt:

  DISM.exe /online /cleanup-image /restorehealth


4.  When finished, run:

  sfc /scannow

5.  Close DOS window
     Reboot

Re-test by clicking the Settings icon. 
Problem should be resolved.

2020-07-01

SQL Server Express Services not Starting - Manual Start

Technical Note:  A local copy of SQL Server Express  (MSSQLServerExpress) is set to start manually and did not start after reboot.  Service Start, Stop, Startup Type = Manual are all greyed out.  Service Start, Service Stop are disabled.

Symptoms:

* SQL is set to start Manually, but Start buttons are grey, unavailable, un-selectable
* Service Start greyed out (gray grayed out)
* Service Stop greyed out
* Startup Type = Manual and is unavailable (gray)
* Service was running when first installed, but is not running after a reboot

Application Error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server.  The server was not found or was not accessible.  Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

SQL Server Management server fails with same message:
(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

Issue:
SQL Server is not started
Service is set to start as a service account (e.g. 'sa' or other) account
Service Login is running with .\admin rights
Likely, your current desktop account does not have administrative rights

Solution:

Run the service with administrative rights.  Start the SQL Server service while logged in with local desktop administrative rights.

Steps:

1.  Click start menu, type "Services".
     Other-mouse-click the Start-Menu's 'services.msc'
     Select "Run as Administrator"

     Alternately:  Start a CMD prompt, running as "administrator"
     At the DOS Prompt, type "services.msc"

2.  In Services (local)
     Locate:  SQL Server SQL Express.
     Other-mouse-click, select "Start"

     Other-mouse-click Service:  "SQL Server Browser". Start.

3.  Close the Services window.

SQL Server is now available.

Notes:  This assumes the [LOGIN] tab's credentials have not changed.

2020-06-23

Windows 10 Command Prompt Black

Problem:  Windows 10 Command Prompt all black. 
CMD CMD.exe all black; black text on black background. 

This appears to be a problem after updating to
2020-06 Cumulative Update for Windows 10 version 1909 (KB4560960)
               Noted that CMD.exe was updated in this release.

Symptoms:
  • When running a DOS prompt from a Windows Start menu tile: all black window
  • When running from Start, (search), CMD.exe: all black
     
  • When running from Task Manager - runs properly
    ctrl-Alt-Delete, select Task Manager. 
    Top-menu, File, "Run New Task"
    Type "cmd.exe"
     
  • Diagnostics:  From within the CMD window, use mouse to select all text (see top icon-menu, Edit, Mark, (highlight text), Edit Copy), then paste into Notepad.  (Text will not be visible while highlighting)  The pasted DOS results are visible in Notepad.  DOS is clearly running, but results not visible.  

  • This is a problem with the current (local or MS) profile.  If you have a second workstation login (for example, a local administrative account), you will find the DOS prompt behaves properly.  This cannot be a problem with the CMD.exe.  Plus, cmd.exe works through other venues, such as Start New Task.

  • This is not a color black-on-black issue.  See DOS icon menu, Preferences, Colors.
Temporary Workarounds:

First Workaround:
Run Task Manager (ctrl-Alt-Delete)
From the top menu, select File, "Run New Task".
Type CMD.exe and allow it to run.
DOS will launch with normal colors; clearly this is not a Color issue.

Second Workaround:
Using File Explorer, open folder C:\windows\system32
Locate CMD.exe. 
Double-click to launch

Third Workaround:
In C:\windows\System32  locate CMD.exe (see directly above)
Pin to Task Bar-- this copy will work (while the desktop tile does not work)


Issue:
This is a corruption in the user's Tiles but details on this are scarce.  Tiles are stored in a user-profile database, not directly tied to the NTUSER.DAT.  I would rather fix the real problem than hide the issue behind a rebuilt profile.  But rebuilding is what I did.


Ineffective solutions


- These solutions did not work but the net suggests them.  Let me save you the trouble, knowing you have searched for these and wondered if they would work.  I tried all:

a.  Rebooting does not help.

b.  Many articles suggest the fore-ground and background colors are the same (black).  This is clearly the issue, but the [color] settings are not the problem.  Fiddle with this and you will find it does not resolve the problem.

If curious:  From the (Black) CMD.exe window, selecting top-left-icon, PROPERTIES, [Colors]. 
Change the background to a different color. 
Close and re-launch CMD.exe for changes to take effect. 

c.  Also suggested, but does not work:  Registry edit:  "HKLM\software\microsoft\Command Processor", "Default Color",.  Color settings in this key appear proper (hex values not documented here).  If changed, close and re-launch CMD.exe for changes to take effect.

d.  Deleting the Windows Start Menu tile and re-creating the tile does not work.

e.  (I have not tried un-installing recent KB patches.)

f.  Running "sfc /scannow" did not help
     Running: DISM.exe /Online /Cleanup-image /Restorehealth   did not help

g.  Deleting the Tile Cache (deep inside the profile; not detailed here because of the risk) did not solve the problem.  Plus it caused other problems, not documented here. 


The Unpalatable Solution:

1.  Create a new Local User Profile (This fixed this problem), but there is much labor.  I did this.  See detailed steps below. Am not fond of this.

Steps: Destroying and Rebuilding Profile:

This is how I fixed the problem, but I am not fond of this solution.  You will be deleting your existing profile and rebuilding a new one. You will lose all preferences in programs like WordPerfect, Office, etc..  Desktop tiles will have to be rebuilt. 

All can be re-constructed.  This is not hard, but is a nuisance..
This has implications to your documents and preferences.  Follow steps closely.

Rough steps:

0.  Record your current Microsoft Login account:
     Click Start, Settings (Gear icon), "Accounts"
     Note your login email address. 
     The password is the one used when logging into the machine.

     If not prompted for a password/PIN when the machine boots,
     login to https://account.microsoft.com  and confirm your password.
 
1.  Using File Explorer, make a backup of all documents in your Documents folder.
     See  C:\Users\(your userID)\Documents
     Place backup in any location other than C:\Users\(your UserID)

     Consider how to backup your browser's preferences, bookmarks, etc. 
     This varies by browser, by browser version.
     I should write an article about this.

2.  Take a screenshot of your Start Menu for documentation.
     Save to any location on the C:\drive -- any location except your DOCUMENTS folder.
     Example:  C:\data\ProfileBackup.png

3.  Build a second User-account on the workstation.  This will be a back-door "Admin" account.

     This is a required step.  Article here:
     http://keyliner.blogspot.com/2020/02/windows-10-administrative-accounts.html

     Confirm this account has local Administrative rights (steps in article)
     From the article, no need to "demote" your regular account to a non-admin
        account as that account will be soon deleted..
     Confirm login to this account

4.  From the article, logout of your normal account (you must log out or reboot)
     Login as the new ADMIN account.

5.  In Windows Settings (Gear icon), click "Accounts"
     Locate and Remove (delete) your normal account.
     (Steps not detailed here.  Follow prompts)

6.  Start an elevated Command Prompt (DOS)
     (Start, Run, "CMD"; Launch as Administrator)

     Type this command:
  net user /add  yourUserID  somepassword

     example:
     net user /add keyliner mySecretPassword22

     Note: By default, this new account (new profile) will be a non-administrative user. 
     Recommend leaving it this way (see article).  If you intend to delete the Admin account
     from step2, you must promote your new "yourUserID" account to an Administrative user.

     Note:  Windows 10 gets confused when the main profile is deleted.  Oddly, you cannot use
     the Control Panel or Gear icon to rebuild the profile, even though those screens have an
     +Add User button.  This forces you to use a command prompt. 
     Unsure why this is and I have not pursued.

7.  Log out of the Admin account. 
     (Start, click "person icon", log-out)

     Login as the new user: 
     (Start, click "person icon", login to the new account)
     This will act like Windows is first-time launching while it builds a new profile.
     This takes a few minutes.

8.  Recommended: 

     Once logged in, click the Windows Settings icon (Start, Gear)
     Go to Accounts.
     Convert the account from a "Local" account to a Microsoft Account.
     Use the same email address/login as the original user-id.
     Steps not detailed here, sorry.

     Reason:  Let Microsoft store your preferences, passwords, etc. 
     Easier to recover if account problems or if entire PC needs to be re-built.

     Microsoft will offer to use a PIN.  Allow this to happen.
     Click the Checkbox to enable alpha-numeric characters and make the PIN the same
     as your login password (recommended).
 
     If you have two-factor authentication enabled (you should!), Microsoft's Authenticator app
        will request authorization.

9.  Using your screenshot as a guide, rebuild all tiles:

     On the Start menu bar, in search, type "Excel". 
     At the program's icon, "other-mouse-click", Pin to Start.
     Rebuild all icon.s
 
     Launch each program.  Set your normal program preferences (default data folders, etc.)


Done.
What a pain.  All this because of a corruption in the Tile menus.

I have been unable to find the Tile database, that is stored in the profile.  Clearing the Tile Cache caused grief.  It may be the cache *is* the database but I doubt it - I found too many icons missing from the cache.  It must serve another purpose.

Related and not part of this issue:  Microsoft announced the DOS prompt / Command-prompt is now deprecated.  Powershell is the replacement. I'll have to write an article with all the replacement commands.


2020-06-04

Lenovo Yoga 900 13ISK Black Screen Wake from Hibernate

Lenovo Yoga 900 13ISK does not wake from sleep or hibernation while plugged into AC power.

Symptoms:
Laptop went to sleep / hibernate / hibernation while on AC Power.
On power-up, with or without AC, appears to boot / wake, but screen black; no activity.
Power-light (right-side edge) on.
No keyboard lights.

Rebooting does not resolve problem.

Immediate Recovery with hard-boot:
1.  Disconnect AC  (assumes battery is partially charged)
2.  Press and hold power-button for 20-seconds.  Release.
3.  Press and hold power-button for (2 seconds).  Release.
Machine should boot.

Long-term Solution:
A.  Update the Intel windows MEI driver.

Go to Intel.com
Search for the current Windows 10 MEI Driver (search "MEI").
As of 2020.06
https://downloadcenter.intel.com/download/28679/Intel-Management-Engine-Driver-for-Windows-8-1-and-Windows-10?wapkw=MEI

Note:  For this laptop, Lenovo's support site lists an older version of the MEI driver, dated (late 2018) -- newer than the drivers that shipped with the machine but not as new as Intel's version.  This is the last version Lenovo officially tested.  Instead, download Intel's latest version.  

Installation requires administrative rights; you will be prompted for UAC approval.

Since this problem is indeterminate and not re-produceable, I may come back to update this article, but initial testing looks promising.


2020-04-27

War and Peace Programming in C# Errata

War and Peace Programming in C# 2019, 2022 Errata



Keyliner has produced a 2,100 page series of books on how to program in Visual Studio C#. 

This is a six volume set, with 1,300 illustrations.  And, it is inexpensive! 

Search Amazon for "War and Peace Programming"

Keyliner article and Description: 
https://keyliner.blogspot.com/2020/04/war-and-peace-programming-in-c.html

Amazon Link:
https://www.amazon.com/War-Peace-Programming-Introduction-Visual/dp/B09QP1YB24/ref=pd_lpo_1?pd_rd_i=B09QP1YB24&psc=1


Source Code Downloads
(especially for Chapter 6 and 7 Utility Functions)
https://drive.google.com/drive/folders/1nubCFPLM4c4xUEGdQOimKxqDn8dsQXU1?usp=sharing

 
Errata
(Kindle does not allow changes to publishing dates)
The most current dates are in the cover pages.

Edition 3.0 2022.05 - all changes below are incorporated, plus other enhancements.  The errata is too hard to maintain for all changes.  I'll only add glaring bugs in code in the future.  

Your comments on sections you like, or struggle with, are welcome.
Thank you.
 
Edition 3.0 2022.05 and older

Chapter 11 (multiple forms)
Passing Values using get-set Properties, Recommended
Error on Overview (page ~277);

private Form string private_strCompanyName = null;

public Form string Public_strCompanyName
{
    get => private_StrCompanyName;
    set => private_strCompanyName = value;
}


Chapter 26 SQL, apx pg 45:  Required SQL Parameters - Active Directory Credentials

Should be static String strDatabase = "Address";


Edition 3.0 2022.01 - published on Kindle:

Upgraded all illustrations and text for Visual Studio 2022.
Expanded SQL chapter to include more details
No known program bugs (with exception of a few tiny, minor ones, not documented here)
New snazzy book-cover.

Kindle does not allow 3.x version numbers and although most illustrations changed for Visual Studio 2022, I did not think the text changed enough to warrant a major edition change.

Edition 3.0 - published on Kindle :

Substantial or pertinent changes to the print edition are recorded here. 
Minor cosmetic, punctuation, or word-choice mistakes are not recorded.  The electronic edition is always up-to-date and can be re-downloaded at will.  I should mention the paper edition is glorious.


Page-numbers approximate and may shift with new content.


Published Vol 6 2021.03: Student and Instructor Project Workbook
(which formerly was the SQL chapters, which were moved to Vol5 in 2020.10). 
Three stand-alone, fun projects.  Does not require other volumes to complete.

Project 1:  Star Trek TOS Bridge Computer Simulation
Project 2:  Luhn Check Digit for Visa Cards
Project 3:  DirectoryPulse - Disk Directory Inventory Program


Version 2020.12:  Vol 3 and 4 only.
- Volume 3:  Formatting chapter:  Reference tables easier to read
- Volume 4:  Improved parts of the array chapter; especially 2-D array over-allocation.
If you have the electronic version of these, re-download them
 

 
Version 2020.10:

3rd Edition, published 2020-04; consolidated and republished 2020-10 

In version 3 (2020-10), volumes were consolidated, making a better value for students:
- less to buy
- less to download
- better value

Chapter's 6 and 7 were moved from Volume 2 into Volume 1.
Volumes 2 and 3 were combined into one larger book, now as Volume 2. 
Volume 4 was shifted to Volume 3
Volume 5 was shifted to Volume 4
Volume 6 was shifted to Volume 5 (SQL)
All with the same basic content, but with minor editing improvements, etc.   If you purchased the electronic version, delete and re-download for updated content.
If paper version, don't fret; same basic content, just in different books.

Volume 6 became a Student and Teacher Project Workbook. 
This is a stand-alone book that does not require the other volumes to be useful.
If you previously purchased electronic Volumes 5 and 6 (SQL), re-download (5) to get that book shifted, then download Volume 6 for a free upgrade.

(Unfortunately:  Kindle does not allow SubTitle changes for the volumes -- they remain fixed with their original topics.  Read the description for an accurate view of the contents.)

- Consolidated chapters and Volumes, making for less to purchase; better price.
   Seeing a book in print changed my perception on how it should be organized. 
   I think you will like these improvements.
- No new content in these volume changes.
- Numerous grammatical fixes, improvements to sentence structure and flow, etc. 
- (Volume 3: Formatting has better reference tables, but I forgot to update the version number)
   Apparently a book is never "done-done."

Chapters 6 and 7 (Utilities, Advanced Utilities)
- Moved to Volume 1.  Volume 1 was 376 pages; now 550 pages.

Chapters 10, 11, 12 (Class Libraries, ScopeForms, ASCII, Parsing)
- Merged to Volume 2  (Volumes 2 and 3 combined into one book.  Now 435 pages)

Volume 4 moved to Volume 3
Volume 5 moved to Volume 4
Volume 6 moved to Volume 5  (Volume 6 now retired; see Volume 5)

Future plans:  Volume 6 become a Student Workbook.


Minor corrections to version 3, dated 2020-04 and Older:
----------------------------------------------------------------------------------------------------------
Chapter 5 - Numbers and Dates

Pages 285...
Fixed several INT "casting" and "Convert.ToInt32" problems where casting and Converting were confused and crossed. 

Chapter 7 - Advanced Utility Functions
Page 145:
StripDuplicateCharactes
Found the routine improperly converted "\\\\" unc paths to a single "\".  Routine modified.
\\\\server\\sharename now properly converts to : \\server\sharename

Page 149 (new):
Added new advanced routine:  ValidiateEmail.
Enhanced ValidateEmail to allow user-bypass (allow audits that would normally fail to proceed.  This was a rare need found when "short domains" were not allowed, but a particular domain needed to be allowed to pass.).

Chapter 10 - Forms
Page 91: 
In "Setting a CheckBox Value Programmatically"
"In Button1's event code, query and report on the status of the checkBox with this logic:"
Should have said: "In Button2's event code, ......

Page 97: 
Radio button best practices.  This section needs an example showing how to remove a check-changed event.  Update pending.  I feel this is a weakness in the text.

Chapter 11 - Multiple Forms

Page 163: 
"Non-form class libraries do *** have an automatically built constructor..."  
should be: "Non-form class libraries do not have an automatically-built constructor..."

Page 206:
The Property illustration mistakenly mixed "private_strProgramVersion" and "private_strServerName" into one paragraph.  This is a minor descriptive text issue and does not effect code examples.

Corrected block of code, with a new section for the ServerName:

    private string private_str

Chapter 12 - ASCII files - Transaction Logging, Log Files

Pages 255, 255+
The description for building a logging routine, and how to cleanup old log files was convoluted.  Changed the text across many pages.  The new version, Revision 3  2020-07 is much improved.


Chapter 13 - Parsing Strings, Tab-delimited, CSV files

Page 282:
Minor typo and a poorly-worded paragraph that substantially effected the text.  Original text: 
'The empty string is an artifact of the first character, first delimiter.  The first character happens to be... finding a *** "(_" ...'    This second parenthesis is facing the wrong direction and substantially effects the meaning of the paragraph.

Paragraph re-written as:
"The empty string is an artifact of the first character, first delimiter. 

"This first character is a "(" delimiter and the split generates an empty cell because there is nothing before the first delimiter.  Similarly, when it finds two delimiters in a row at the end of the area-code, finding a parenthesis and a space ")_", the .split takes everything between (e.g. – nothing), adding another blank cell in the array.

Page 288, 294, 296:
Typo on the input line.  Change field value 1130.00  to 1130.50
string strInputLine = "Fuel Expenses:,1000.00,1130.50,1200.00";


Chapter 14 - INI files

Page 31 "Using CL860 INI File Read"
In the Summary Steps, move step 2 ("in top menu... Change command-line arguments") to a new Step 7.  

Chapter 19 - Waits, Delays, and Pauses

Page 173
[ ] Do not create the directory  (was for Visual Studio 2017), now should read:
[x] (check) Place solution and project in the same directory

Page 173, step 5
Remove phrase "//...pasting both 'wait' and the upper-cased 'Wait' functions." 
In 2019, the lower-cased overload is no longer recommended.  The lower-cased overload was for the convenience of the programmer.

Page 178 (CL805_Wait)
The Wait-routine had several typos:  Here is the completed version:

public void Wait(int ipassedSeconds)
    {
        //Use:  Wait(nn) seconds       

        int iwaitTime;

        if (ipassedSeconds == 0)
            iwaitTime = 220;    //about a quarter second, fixed
        else
            if (ipassedSeconds == -1)
                iwaitTime = 80;            //flash - about a 10th sec
            else
                iwaitTime = ipassedSeconds * 1000;   //Convert to millisecs

        while (iwaitTime > 1)
        {
            System.Threading.Thread.Sleep(110);
            System.Windows.Forms.Application.DoEvents();
            iwaitTime = iwaitTime - 110;
        }


Page 190: Form_Load event
boolcancelLaunchSW   should be cased like this:  boolCancelLaunchSW  (2 places)

Chapter 22 - Arrays

Page 19:   description of 3D array.  Embarrassed to have the wrong addresses in the intro.
Instead of "the cell in the top-sheet's lower-left corner..."
was [7,0,0]   Should be:  [0,7,0]
was [2,2,4]   Should be: [2,4,2]

Page 85: 2D array sorting.  The illustrations were a train-wreck.  This and next two pages re-illustrated.  Sorry not included here.  (Version 2020.12 vastly improved this section.  2-D array sorting, etc., is difficult to explain, but I think I got this right in the 2020.12 version).

Page 71, Sorting Arrays, Step a)

Was:         A021_SortNumbers(astrNames, aiNumbers);
corrected  A012_SortNumbers(astrNames, ref aiNumbers);

Page 87: Step c:  "Create three new intermediate arrays, one for each column:

Chapter 24 Console Apps

Added Index and TOC entries for "CommandLine Parms", Parameters.
Should add this to the INI file chapter, where it was also needed.


Source Code Downloads:
Now published.  See the top of this blog.


2nd Edition:
The second edition was published Chapter-by-Chapter (roughly 70 pages per chapter), but was too difficult for students to download, requiring 28 separate transactions; it was an experiment that failed.  Those single-chapter-books are way out of date and should be discarded for the newer, consolidated volumes.

2020-04-23

Greenshot - ScreenCaptureProgram

Recommended - Greenshot Screen Capture Program

I do dozens of screenshots daily, using them for illustrations or for quick snapshot or reminder of something I need to do.  I typically have a dozen little windows open during the day, using them like a clipboard or an illustrated task-list.  And, of course, I use them to grab illustrations. 

Greenshot is my tool of choice and it is super-easy to use.  
Press PrintScreen, draw a rectangle around the topic. Press enter. 
Save the screenshot as a file, or onto a small editor window.






Greenshot is a community-developed tool; source code available on Github.  For Windows users, is free, where they ask for a light donation.  I like this tool better than Windows "snipping tool."

Download link:  https://getgreenshot.org/downloads/




Installation

Because my Windows user account is a non-administrative account, I had a minor problem when installing.  If your local account is an administrative account, skip these steps and simply install

Non Administrator installation: 

1.  Using File Explorer, create folders before starting the installation:
     C:\ProgramFiles\Util
     C:\ProgramFiles\Util\GreenShot

2.  Download the Installation (to your normal installation directory, typically, "Downloads"
     Download link:  https://getgreenshot.org/downloads/

3.  Using File Explorer, locate the downloaded file. 
     As of 2020-04, "Greenshot-Installer-1.2.10.6-Release.exe"
     Shift-Right-Click the .exe,
     Choose "Install as another user"; use your administrative login.


Related articles:
Quit using an administrative account for day-to-day work.
https://keyliner.blogspot.com/2020/02/windows-10-administrative-accounts.html

2020-02-17

Windows 10 wakes from Sleep - Solution

How To: Windows 10/11 wakes from sleep.  Windows 10/11 computer wakes unexpectedly from Sleep.

This article was originally written for Windows 10.  Windows 11 is better behaved and has not experienced late-night wakes nearly as often. 

Follow these steps for stopping a computer from waking from Sleep or if the computer fails to go to sleep as expected.  These steps will stop many, but not all WAKE events.  This is a work-in-progress.

With the advanced steps, below, use with some caution and reservations, as noted. 

Requires local Administrative rights to the workstation.  Steps here include manual override, assuming you are using a non-adminstrative account.  Use these login steps, regardless.  See this keyliner article on why you should always run your computer with non-administrative rights: 
Link: https://keyliner.blogspot.com/2020/02/windows-10-administrative-accounts.html


[2020.06 Update:  Steps 1 - 8 have worked very well with my PC.  No further research needed.  I still do not recommend step 9]


Make all of these changes to fix Sleep problems:

1.  Launch Windows Device Manager as Administrator:
"Administrative rights" also known as "Elevated privileges", or "Elevated rights"
 
Non-administrative users: Do not launch Device Manager through Control Panel.
(The Windows Control Panel is nothing more than a menu; running it with Administrative rights offers no benefit.)

a.  From the Start Menu Search box, type

"C:\Windows\System32\Devmgmt.msc".

b.  From the search results, single-click.  Select "Run as administrator" (or right-mouse-click the found program and select "run as administrator.")

If prompted, type your administrative credentials to login. 
If not prompted, your account already has admin rights.  Consider reviewing this article.)

Click for larger view


2.  Locate and expand "Network Adapters"

Click for larger view

a.  Click each found adapter.  If it has a "[Power Management]" tab,
Most (WAN and PNP) adapters will not have this setting

     uncheck [ ] Allow this device to wake the computer.

b.  If the machine has both a wired and wireless adapter (many desktops and laptops do), make this change for each adapter.

Disadvantage: On some corporate networks, this stops the network administrator from powering-up the machine for maintenance.

If the message:  "You are logged on as a standard user.  You can view device settings in Device Manager, but you must be logged on as an administrator to make changes."  See Step 1.


3.  In Device Manager, locate "Mice and other pointing devices."

Click for larger view
Examine each device. 
If a [Power Management] tab, uncheck "[ ] Allow this device to wake the computer."

Benefit:  A bumped desk will not wake the computer.
Minor drawback:  Press any keyboard-key to wake computer.


4.  In Task Scheduler, change how updates happen.

Windows 10 only.
Using steps similar to step 1, Start, search "Task Scheduler"
Open Task Scheduler with administrative rights

a.  On the tree side, expand "Task Scheduler Library"
b.  Expand "Microsoft", then "Windows"

c.  Still in the tree-side, in the long list, locate "UpdateOrchestrator"
     In the center detail list, Locate "Reboot"
     In the [Conditions] tab, uncheck "[ ] Wake the computer to run this task"



Minor Drawback:  Some updates may be delayed.  This is not an issue.  You will be prompted if a reboot is needed and a convenient time can be picked.

Other issue:  Other scheduled tasks in this same general area, discoverable in Step 6, are not editable, even though they run from within Task Scheduler and even though changes are made with administrative rights.  See below for Advanced Disable Steps.


5.  If McAfee Virus Scanner is installed... Uninstall

This reportedly wakes the PC often.

No specific steps listed here, but in general, use the Control Panel's "Programs and Features" to uninstall the program.  Uninstall for this, and other reasons.  Be aware McAfee's uninstall does a poor job uninstalling.   See their website for a more robust un-install tool, which does a better job uninstalling, but it still does it badly. 

I am similarly suspicious of Symantec, and Avast virus scanners for the same reasons.

I recommend using Microsoft's built-in scanner ("Defender"), which is better, with less overhead.  


6.   Other research

Expect more Wake events. 
As they happen, use this step to diagnose which program is waking the PC. 
This report can be checked well-past the actual event but be aware the report is lost at reboot.

a.  Following the procedure in Step 1, search for and launch "CMD"  (DOS Command prompt).  Launch with Administrative rights.

b.  From the DOS prompt, type this command: 

powercfg -lastwake

Click for larger view

Review the cryptic report.  This may give hints to other programs which may be running in the background, or which may be in the Windows Task Schedule.  Things such as Acronis Backup or other such programs may be there.  How to resolve these varies by each software publisher.

If you see "USB eXtensible / Generic USB xHCI Host Controller", this is probably your mouse, disabled on a previous step.

This report has a long memory, surviving the last event until the machine is rebooted.  Sadly, the report is not dated. 

My report detected the wake event documented above, in Step 4, which was subsequently fixed -- but the event remained in the report for several days.  Then, a few days later, the machine woke again.  The new report  showed:

Reason: Windows will execute 'NT TASK\Microsoft\Windows\UpdateOrchestrator\Backup Scan'

>This one is harder to fix and I have not been willing to do this: See below, under "Advanced Disable Steps.

2022.12

See also this similar command, which shows all hardware devices allowed to wake your PC.  Typically finding Mouse and Keyboard:

powercfg -devicequery wake_armed



7.  Other auto-startup programs may affect Wake events 

Programs in the Startup group, or in Services.msc, may or may not cause Sleep-Wake problems. 

This is documented here as an advanced subject.

a. Locate Startup Programs

Start Menu, Settings (the Gear icon),
"Apps". 
Select Left-Nav [Startup].

Programs in this area likely unattended and "may" wake the PC at odd-hours.
Do not disable without researching consequences.

For example, on my computer I have disabled
* All Acronis Backup backend-processes, with the understanding I have to manually launch when needed.

* I disabled Intel Graphics Command Center; knowing I had access via the Control Panel, and knowing I was using an external Video-card.

* Older computers may find Java updaters, and other vendor updaters. 
I would disable and run updates manually. 
Updaters are notorious for firing at odd times.


b.  Windows Services.msc

Windows also has (hundreds) of services which run in the background.

From the Start Menu, search, "Services.msc". 
Launch with administrative rights.

Just because the service is running, this does not mean it wakes the PC from sleep. 
Research before disabling services. Use care in this area.  With this said, I have not identified any common or obvious services.  For example, i did find Microsoft SQL Server Express running on my development machine; this was set to manual.  On your computer, this service would be unlikely.  I have disabled services for other reasons, not documented here.

When disabling a service, set the service to "Manual" (manual startup), acting as a flag so you know which ones you have touched.


8 - Advanced Disable Steps

Even with the changes above, using Step 4's reporting, I found other values in the UpdateOrchestrator key where [ ] Wake was allowed to run. 

For example, the "Backup Scan" key is set to Wake, showing in the report like this:

Reason: Windows will execute 'NT TASK\Microsoft\Windows\UpdateOrchestrator\Backup Scan'

-- but even with Admin rights, Task Scheduler would not allow an update to this event's schedule  (prompting for credentials did not work). 

Reviewing this task, it appears to trigger either Weekly or Monthly (note the Next Run Date).  This is not following the Scheduler's normal daily or weekly scheduled tasks!  I theorize: The Backup runs, then sets its own next schedule, only having one day in the schedule, and that day varies. 



9 - UpdateOrchestrator's other events can be disabled:
-----------------------------------------------------------------------------------------
(not recommended - these are nasty steps and are here for documentation)

I am reluctant to disable the these tasks using these steps, not yet knowing the consequences.
If these steps are used, it disables the services -- there is not a way to simply turn off the [ ] Wake from Sleep setting.  However, it is safe to play with this idea as it is easily un-done.  DOS skills are required.)


a.  Create a folder, such as C:\data\downloads\Software\PSTools.
 
b.  Download PSExec (part of PSTools), from Microsoft (a .zip file).

https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
 
c.  Open the .ZIP.  Highlight all files.  Select "Copy"
     Paste all files in the ...\Software\PSTools folder


d.  From an administrative DOS prompt:

C:

CD\data\downloads\software\pstools
psexec.exe /acceptEula

If the Eula is declined (or some other problem), search the web for PSexec's EULA registry key.  Set the key-value to = 1.  Apologies, I neglected to document this properly.


e.  From this article: 

https://pastebin.com/tDaQwQ9L

Download the illustrated batch file.
Save to ..\Software\PSTools  folder.
Rename the long batchfile name to a shorter name, such as "disableWakeTimers.bat"


Comments about the Batch file:
  • Windows 10 only
  • Must run DOS prompt as Administrator
  • Requires PSTools from Microsoft:  Download steps, above

The edited batch file can lock itself (unheard-of with Notepad and yet it seems to happen)! 

With any editing changes, use Notepad to make the changes.  Close and save.  Then, re-open the Notepad .bat file and confirm the changes were actually saved!  If changes are lost, close the DOS Window, Close Notepad.  Re-open both, and re-edit/save the file.  This appears to release a file-lock.

f.  Instead of letting the batch file stop a half-dozen services, consider editing the batch, commenting-out all changes except for the "Backup Scan."  This way, you can test the process, and test restoring the system to its original settings. 

Edit the batch file:  REMark all lines except "Backup Scan":

schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\Backup Scan"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\AC Power Download"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan Static Task"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\UpdateModelTask"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\USO_UxBroker"
Rem schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\AC Power Install"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\Universal Orchestrator Idle Start"
REM schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\Universal Orchestrator Start"


This is the line that is allowed to run (larger font):

schtasks /change /disable /tn "\Microsoft\Windows\UpdateOrchestrator\Backup Scan"

where all are "REMarked" except "Backup Scan"
Close and Save the file.  Reopen in Notepad to confirm changes.


g.  Save the changes to the batch file. 
Close Notepad.  Re-open the batch file and confirm changes were accepted.  (I had problems with this during testing)
 

h.  From the same Administrative DOS prompt:

c:
CD\data\downloads\software\pstools
disableWakeTimers.bat


i.  Confirm the changes:

     Start "Task Scheduler" as Administrator  (From Start, search "Task Scheduler")
     Launch as administrator  (if not many keys are hidden)

     Tunnel to ....\Windows\UpdateOrchestartor
     Review the Backup Scan task.  It should be disabled.
         Note:  it is not "[  ] Allow Wake"; instead, the entire task is disabled!


To re-enable:
--------------------------------------------------------------
Close the DOS prompt
Close Notepad
Re-open Notepad
Change "/disable" to "/enable"
Save Batch file; re-open to confirm.
From an Administrative DOS prompt, re-run the batch file.
Confirm with an Administrative run of "Task Scheduler"; note next scheduled date...

If satisfied with testing, continue and disable all:
------------------------------------------------------------------
Close, etc., all.  Edit the file, removing all REMarks.
Re-run the batch file to disable all tasks.

This is a less-than ideal.  "schtasks" does not have a command option to [ ] Allow Wake.
This is a lot of work, and some danger, just to stop these services from waking.  I have not experimented with forcing a new "Monthly" schedule -- fearing it would run monthly (which means far-fewer Wakes, but I fear it would stack multiple schedules for its next run.

Microsoft's documentation for "schtasks" can be found here:
https://docs.microsoft.com/en-us/windows/win32/taskschd/schtasks


Comments are welcome.


Related articles:
Windows 10 Administrative Account - Everyone should do this
Frankenputer - Building a new Home PC - much fun

2020-01-03

Logitech G513 Keyboard

Logitech G513 Keyboard

Keyliner's new Frankenputer, "Nancy," wanted a new keyboard. 

I have long been a fan of mechanical keyboards, but I have been using cheap plastic keyboards for the past several years.  They universally suck.  Some are better than others, but nothing beats a mechanical keyboard.  This is a review of the Logitech G513 Mechanical Keyboard.

2023.04 Update:  After 3 years of use, the keyboard started randomly ddouble-ttyping letters, especially with the space-bar.  Searching the web, you will find there seems to be a history with this problem.  Here are ten things that I tried -- all pointing to a hardware problem.  I found no solutions -- except for one:  Abandon the keyboard.  I replaced the keyboard with a Razor Blackwidow V3.

Here are the things tried:

1)  Many suggest changing the keyboard control panel setting for Repeat-Rate speed.  What a horrible idea.  It makes everything slower -- for example, arrow-key scrolling down a file, choosing items from a selection box, etc.  

2)  Many suggest removing all keys and super-clean the switches/keyboard, etc.  This did not solve the problem.  Plus, what are the odds multiple keys had the same problem?

3)  Suspecting a software problem, I reverted to an older version of GHub.  Nope.

4)  Uninstalling GHub (registry clean, etc.).  This did not resolve the problem.  This had the side effect of disabling  all GHub features, including the lighting.

5)  The keyboard has a Y-USB cable, one side for data, and the other for the lights.  I tried disconnecting the power to the lights.  Nada. 

6)  Move the keyboard to a different computer and test there.  (I did not install the Ghub software.)  Problem persists, indicating a hardware problem.

7)  I tried different USB port(s).

8)  Use a different keyboard on same machine.  Found no issues, again indicating this is a hardware problem.

9)  I found related, registry hacks for "bounce-back" rate, and I found user-developed programs that ran in the background, helping to control "bounce rates", etc.  Uhm, no.  This is a keyboard for god's sake.  I should not have to work this hard.  Plus, bounce-rates change how the keyboard behaved when you purposely wanted repeating characters.

10)  This option worked:  Give up.

There is the possibility a Microsoft Windows update caused this problem.  Seems unlikely, but I could not adequately test this.  My feeling is if this were true *all* logitech keyboards (or perhaps all keyboards) would fail.  As busy as this problem is on the Internet, I am not seeing this.


More notes; 
--------------------------
The GHub software is suspect but the testing above discounted that possibility. 

In addition to GHub being hard to use (setting colors, etc,), it is a weirdo bit of software that crashes after updates (not detailed here).  Often, it requires complete un-install, re-install. 

One of the problems is the software needs administrative rights to update but if you are running as a standard user, the update happens, and fails, without your knowledge.  If you use GHub, disable all auto-updates.  Although the program has a switch for [x] Disable Automatic updates, it ignores its own setting. You'll have to remove this from the registry.


Finally, adding another insult, two keys refuse to set their color.  I know the colors work because "rainbow" effects show all the colors under each key.  This is probably a problem with the GHub software.

Net opinion:
-------------------------------
I enjoyed the keyboard; loved the RGB colors; liked the keyboard action, but I would not buy this product again.  Clearly the vendor must know of this problem -- there is too much chatter on the Internet, but all of the lame steps (cleaning the keyboard, setting a slower repeat rate) are half-ass solutions that don't address the real issue.  This must be an internal hardware problem, but nobody is fessing-up.

T.



Original Review below:  It was glowingly positive.
-----------------------
Even though I am not a gamer, Logitech won my business with the G513 Gaming Keyboard ($130). 




Keyboard Features:
  • Romer-G Tactile (mechanical) keys
  • Backlighted keys - surprised at how much I liked this
  • Individually controlled key colors:  See photos
     
  • Weight!  This is a heavy keyboard.  1,100g (2.5lbs)
  • "Aircraft-grade" 5052 Aluminum-magnesium alloy; black or silver.  Feels substantial.
     
  • USB Wired (not wireless); braided cable
  • Nice Palm-rest
  • Fully-programmable keyboard, with macros, etc.



Drawbacks:
  • Moderately expensive: $130. 
    Nobody really wants a twenty-dollar keyboard, but we tolerate them.  Mechanical keyboards are more expensive and always will be.  These are the rib-eye steaks in a hamburger world.
      
  • No Num-lock light (why not?)
     
  • Not as "clicky" as the IBM 3270 Cherry-switch keyboards or the GL915's GL switch; this is good and bad.  No doubt this keyboard is quieter.  (The GL915, besides being more expensive, has other features such as volume controls, wireless, dedicated macro keys, etc., that I did not want.)
     
  • When the keyboard is first plugged in, it has a wild, and undulating color scheme.  This is done purposely, making you want to download the software to stop this nonsense. From the Logitech site, download and install "Logitech G Hub".

  • The Software auto-updates and is hard to block.  Even though the Settings screen has a checkbox to stop Auto-updates, it ignores this and updates anyway.  Occasionally (twice in the past 3 years) it muffs the update and you have to uninstall, clean the registry and re-install.  In the end, it takes fiddling in the registry to stop the updates and I apologize for not documenting it here.

The keyboard is fully programmable with macros and other features, none of which I have used, not bothering with anything but setting the colors.  Color settings are not saved to the keyboard, but instead are stored in the software, "Ghub".  The keyboard will work without the software, but you will not have any control over the lighting.


Full-Color, illustrated:
Although not evident in this picture, I set the home-row anchor-keys "F" and "J" to bright green, where the other alpha keys are a polite blue, making it easy to glance at the home row.   The number-row is red (orange in this picture; a white balance problem).  Page-up and down are yellow.  There was much fun setting these.




The software controlling this is weird and takes fiddling (it is actually pretty hard to use).  It also seems to be buggy.  It can get into states where changing one key's color changes others.  It is more accurate to say the software is irritating.  

Mechanical Switches

The keyboard's key actuators are why you have a preference for one keyboard over another.  Logitech has probably a dozen different actuators.  Cheap keyboards have a plastic-dome sheet that sits under the keys.  When a key is pressed, the dome collapses, making an electrical contact.  These are "mushy," have poor key-travel, with little tactile feedback.

With a mechanical switch, there is a metal spring  or other design features that provide resistance. On key-press, it hesitates with more resistance.  A micro-second later, as the key is partially-pressed, it reaches a breaking-point and accelerates to the electrical contact.  This gives the keys a satisfying click.  Your fingers detect this and touch-typists appreciate the firmness.  The original IBM 3270 and PC-XT keyboards are classic examples of this design.


Logitech has three different mechanical switches, each with different feel, travel, and sound.  


 
I selected the G513 with a Romer-G "Tactile" switch  (which is different than the boring Romer-G-Linear switch), and not quite as good as their more expensive GL-switch. 

There are better mechanical switches on the market - with different tactile feedback and "clicky-ness."  The keyboard I wanted was the G915 with GL-Clicky switches, but $230 was out of my league.  Costs and sound-considerations come into play.

If you can, try the keyboard out.  Those Best Buy folks are helpful.  I asked a clerk if we could open an box and they happened to have one plugged into a computer along the back wall.  This gave me a chance to feel the keys in the wild.  This is why Best Buy gets my business.  Brick and mortar is worth supporting.  

Conclusion:

This new keyboard completes my new computer build.  Not only is the new computer fast, modern, and functional, it now feels better.  When nobody is looking, I sit in a darkened room and caress the keys. 

Keyliner previously reviewed the Microsoft Sculpt keyboard, which was well-liked but abandoned.  I type on too many non-sculpt keyboards, and my fingers were confused.  If all keyboards were this style, this would be a hands-down favorite.  If it used the Romer-G or the GL-Clicky actuators, it would be the best keyboard in the world.


Firewall Issues:
After a reboot, Windows Firewall asked for permission to allow LGHUB AGENT (the Logitech software that configures the keyboard).  I promptly denied, thinking the keyboard was already programmed.  Custom colors were lost and had to be re-set.   

If you firewalled this like I did, Start, Run, Firewall.  Launch Windows Defender Firewall.  In the Inbound rules, locate LGHUB AGENT.  Select Properties.  Change to "Allow the connection if secure."  Re-program your colors.



Related links:
Unicomp Buckling Spring Keyboards - an IBM 3270 keyboard; a favorite that I have used for many years, using an honest-to-god Cherry-switch.  It is a loud keyboard, but glorious.  Sigh... the keyboard looks so dated, with no backlighting.  I wish they would call me for my industrial-design advice.  I want them to succeed.


Related articles:
Microsoft Sculpt Keyboard
Microsoft Sculpt Wireless Mouse Less Accurate

Keyliner's Newest Frankenputer:  "Nancy"