Microsoft

Random Stuff

Logged-in users

query user /server:$Computer
query user /server:$SERVER

interesting: https://adamtheautomator.com/how-to-get-the-current-user-logged-on-with-powershell-all-the-ways/

Uptime

Get-CimInstance -ClassName Win32_OperatingSystem | Select LastBootUpTime
Get-Uptime

Events

Get-WinEvent -LogName "Microsoft-Windows-WindowsUpdateClient/Operational" -MaxEvents 20 | Format-Table TimeCreated, Id, Message -AutoSize

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-winevent?view=powershell-5.1

Powershell

Win11

Useful shortcuts

Settings

+ ISettings

Power user menu

+ XPower user menu
+ X then iOpen Powershell
+ X then aOpen Powershell (Admin)

Execute Command

+ RExecute command
+ R then “control panel”Control Panel
+ R then “control update”Windows update
+ R then “sysdm.cpl”System Properties (Rename, join domain etc…)
+ R then “lusrmgr.msc”Local Users and Groups
+ SSearch bar
+ S then “name”Opens system where the computer name is…

Screenshots

+ Print Scrscreenshot the entire screen and save it as a file (C:\Users\$USER\Pictures\Screenshots, screenshots all screens)
Alt + Print Scrscreenshot the active window and copy it to the clipboard
+ Shift + SSnipping Tool

Task Manager

Ctrl+Shift+EscTask Manager

UTF codes

Alt + 0231ç
Alt + 128 or Alt + 0199Ç

Real restart (bypass fast reboot)

Hold shift while hitting shutdown.

Sudo for Windows

Enable

To enable Sudo for Windows, open Settings > System > For Developers and set Enable sudo to On.

Usage

Launch an executable with admin rights. But to launch a Powershell cmdlet:

sudo Powershell.exe Add-DnsClientNrptRule -Namespace ".maison.lan" -NameServers "192.168.2.1"

https://learn.microsoft.com/en-us/windows/advanced-settings/sudo

WinGet (M$ Store Packaging System)

list

winget list
winget ls
winget list --upgrade-available
PS C:\WINDOWS\system32> winget list --upgrade-available
Name          Id                 Version        Available      Source
---------------------------------------------------------------------
Live Connect  Kaseya.LiveConnect 9.5.9259.13690 9.5.9368.10610 winget
usbipd-win    dorssel.usbipd-win 5.1.0          5.2.0          winget
Google Chrome Google.Chrome.EXE  139.0.7258.157 140.0.7339.128 winget
3 upgrades available.

upgrade

-r, –recurse, –allUpgrade all installed packages to the latest version if available.
-u, –unknown, –include-unknownUpgrade packages even if their current version cannot be determined.
–disable-interactivityDisable interactive prompts.
–authentication-accountSpecify the account to be used for authentication.
PS C:\WINDOWS\system32> winget upgrade Google.Chrome.EXE
Found Google Chrome (EXE) [Google.Chrome.EXE] Version 140.0.7339.128
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dl.google.com/release2/chrome/hdnjiv63b5mmcarflvagn4gs5y_140.0.7339.128/140.0.7339.128_chrome_installer_uncompressed.exe
  ██████████████████████████████   415 MB /  415 MB
Successfully verified installer hash
Starting package install...
Successfully installed
sudo winget upgrade --all --disable-interactivity
winget upgrade --all --disable-interactivity --authentication-account MYCOMP\localadmin
PS C:\WINDOWS\system32> winget search vlc
Name             Id                    Version                 Match        Source
----------------------------------------------------------------------------------
VLC media player VideoLAN.VLC          3.0.21                  Moniker: vlc winget
pympress         Cimbali.pympress      1.8.6                   Tag: vlc     winget
Screenbox        Starpine.Screenbox    0.16.0                  Tag: vlc     winget
Streamlink       Streamlink.Streamlink 7.6.0-1                 Tag: vlc     winget
wcap             mmozeiko.wcap         2025.05.26              Tag: vlc     winget
SubRenamer       qwqcode.SubRenamer    2.4.0                   Tag: vlc     winget
tuna             univrsal.tuna         1.9.11                  Tag: vlc     winget
VLC media player VideoLAN.VLC.Nightly  4.0.0.0-nightly20250910              winget

install

PS C:\WINDOWS\system32> winget install vlc
Found VLC media player [VideoLAN.VLC] Version 3.0.21
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://download.videolan.org/videolan/vlc/3.0.21/win64/vlc-3.0.21-win64.exe
  ██████████████████████████████  42.8 MB / 42.8 MB
Successfully verified installer hash
Starting package install...
The installer will request to run as administrator. Expect a prompt.
Successfully installed

uninstall

winget uninstall "Web Companion"

https://learn.microsoft.com/en-us/windows/package-manager/winget

Updates

USOclient

    RefreshSettings – used to quickly enact any settings changes
    RestartDevice – as the name implies, it restarts the device. Can be used in a script to allow updates to finish installing on next boot.
    ResumeUpdate – used to tell the tool to resume updating after a reboot.
    StartDownload – initiates a full download (from Microsoft) of existing updates
    StartInstall – kicks-off the installation of the downloaded updates
    ScanInstallWait – Combined Scan Download Install
    StartInteractiveScan – we’ve yet to get this one to work, but it suggests that the process may work in a GUI
    StartScan – kicks-off a regular scan

https://learn.microsoft.com/en-us/answers/questions/2826316/usoclient

Powertoys

+ Alt + SpaceWindows Command Palette
+ Ctrl + XAlways On Top

Alternative shell

https://github.com/Open-Shell/Open-Shell-Menu

Annoyances

Bypass Microsoft Account creation during Windows 11 installation

At the Sign in to your microsoft account when OOBE won’t work anymore, shift+F10

start ms-cxh:localonly

Credits: https://www.reddit.com/r/sysadmin/comments/1jp5vln/an_alternative_to_bypass_microsoft_account/

Missing Snipping Tool

winget install "snipping tool"

Re-enable the old right click context menu

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

Then restart the Windows Explorer process.

Back to windows 11 default:

reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f

As script:

:: Set "Old" Explorer Context Menu as Default
reg add "HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f

:: Remove Explorer "Command Bar"
reg add "HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" /f /ve

:: Restart Windows Explorer. (Applies the above settings without needing a reboot)
taskkill /f /im explorer.exe
start explorer.exe

:: Empty Comment (Prevents you from having to press "enter" to execute the line to restart explorer.exe)

Offline files fill the system disk when multiple users are using the machine

  • open Sync Center
  • Manage offline files
  • Disable offline files
  • restart
  • Delete the contents of the folder C:\Windows\CSC
  • Re-enable offline files (?)

Excel (and Libreoffice)

Useful shortcuts

Ctrl + VPaste
Alt + Ctrl + V then VPaste without formatting

Move a column (or a row)

  1. Select the column: Click the letter at the top of the column you want to move to select the entire column.
  2. Position the cursor: Move the cursor to the edge of the selected column. The cursor will change into a four-headed arrow (or a hand on a Mac).
  3. Hold Shift and drag: Press and hold the Shift key on your keyboard, then click and hold the left mouse button. Drag the column to the left until a bold vertical line appears in the desired new location.
  4. Release: Release the mouse button first, then the Shift key to drop the column in its new spot.

How to work with durations in formulas

Format cells to: [HH]:MM

Excel/Libreoffice sees days and not hours, so one hour is 1/24 (day) and forty hours are 40/24.

So to substract cell A1 containing a duration from 40:00:

=(40/24) - A1

Open a CSV file in Excel

To open a CSV file in Excel, open a blank workbook, go to the Data tab, and select From Text/CSV (or From Text in older versions).

Outlook

Tasks

see the connection status

Hold Ctrl and right-click the Outlook icon in the system tray -> Connection Status

Entra Shit

Tasks

Join en existing device

Settings / Accounts / Access work or school / Add a work or school account (Connect)