Wednesday, March 8, 2023

20230308 Start Docker Desktop at the Windows Startup

https://stackoverflow.com/questions/51252181/how-to-start-docker-daemon-windows-service-at-startup-without-the-need-to-log/59467740#59467740

  • Task Scheduler
  • General
    • User: xxxx
    • Run whether user is logged on or not
    • Run with highest privilege
  • Triggers
    • At Startup
    • Delay task for 1 minute
    • Enabled
  • Action
    • Start a program
    • C:\Program Files\Docker\Docker\Docker Desktop.exe
Needed:
  • User xxxx must be in the Administrator group (edit Local Users and Groups)
  • May add xxxx to docker group

Additional:
  • Manually start Docker Desktop, accept agreements, uncheck "Open Docker Dashboard at Startup"
The agreement and dashboard may block the auto startup. 



Tuesday, January 10, 2023

20230110 Error Code 0x800F0954 Windows 10

Temporarily bypass WSUS server using the following registry edit (requires administrator privileges).

1. Right-click Start, and click Run
2. Type regedit.exe and click OK
3. Go to the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
4. In the right-pane, if the value named UseWUServer exists, set its data to 0
5. Exit the Registry Editor
6. Restart Windows update service

Reference: https://learn.microsoft.com/en-us/answers/questions/112308/error-code-0x800f0954-on-windows-10.html

Wednesday, December 7, 2022

20221207 PowerShell auto update

 PowerShell 7.2 enables a default auto update with Windows Update. 

To disable,

$pwshRegPath = "HKLM:\SOFTWARE\Microsoft\PowerShellCore"
if (!(Test-Path -Path $pwshRegPath)) {
    throw "PowerShell 7 is not installed"
}

Set-ItemProperty -Path $pwshRegPath -Name UseMU -Value 0 -Type DWord

Thursday, November 3, 2022

20221103 Windows Server 2019 Docker Linux container

Reference

https://stackoverflow.com/questions/57317141/linux-docker-ee-containers-on-windows-server-2016/57691939#57691939

https://github.com/docker/labs/issues/490

https://computingforgeeks.com/how-to-run-docker-containers-on-windows-server-2019/


Thursday, May 26, 2022

20220526 git move folders with their history to another repo

Main ref: https://mattsch.com/2015/06/19/move-directory-from-one-repository-to-another-preserving-history/

If there are multiple folders, we need to do thing differently.

  1. Source repo
    1. git remote rm origin
    2. git filter-branch --index-filter 'git rm --cached --ignore-unmatch -rf XXX' --prune-empty -f HEAD
      1. for all other folders or files
      2. for all subtrees, just do a clean up
  2. Dest repo
    1. git remote add <branch> <source repo directory>
    2. git checkout <branch>
    3. git checkout <Dest repo working branch>
    4. git merge develop --allow-unrelated-histories
    5. git push
    6. add back subtree
    7. git push
The assumption is that the directory names in the source repo remain the same in the dest repo.  If different, the commit history needs to change. 
  • Directory name and level manipulation shall be done at the Source repo side.  This shall greatly simplify the merge. 

Thursday, April 28, 2022

20220428 LDAP query

Download and install Remote Server Administration Tools for Windows 10

  • https://www.microsoft.com/en-us/download/details.aspx?id=45520

Open up a Powershell console and use Active Directory cmdlets

  • https://docs.microsoft.com/en-us/powershell/module/activedirectory/?view=windowsserver2022-ps

Examples:

Get-ADUser -Identity "username"

  • get basic user info

Get-ADPrincipalGroupMembership username| select name

  • get all groups that a user belongs to


Get-ADGroup

Get-ADGroupMembers



Wednesday, March 30, 2022

20220330 powershell configure pagefile.sys

 Only for Powershell 5

Get-Volume; $pagefile = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges; $pagefile.AutomaticManagedPagefile = $false; $pagefile.put(); $pagefileset = Get-WmiObject Win32_pagefilesetting; $pagefileset.InitialSize = 1024; $pagefileset.MaximumSize = 8339; $pagefileset.put();Gwmi win32_Pagefilesetting | Select Name, InitialSize, MaximumSize; restart-computer -force