Skip to content

Tips & Tricks

GPOs

View Applied Policies with the Command Prompt

gpresult /r
User scope
gpresult /User xxx /v
Save results to a file
gpresult /R > c:\RsopReport.txt
Machine scope (needs to be admin and can be a remote machine)
gpresult/r /scope computer

use RSOP.msc to view applied gpo from the domaine controler
rsop.msc
Use GPResult Command to Check Group Policy: Step-by-step Guide (comparitech.com)

Windows Licences Activation

Activate Windows Server 2019
cscript c:\windows\system32\slmgr.vbs /ipk <product_key>

example: cmd cscript c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Activate Windows Server 2022
Dism /online /Set-Edition:ServerStandard /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula

Microsoft Change Product Key Of Office 2016/2013

=> look for a file called OSPP.VBS

If you’re running 64-bit Office on 64-bit Windows, use the following command:
cscript “C:\Program Files\Microsoft Office\Office15\OSPP.VBS”/inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Upgrade Windows server 2022 from Evaluation to Standard

Verify which editions the current installation can be converted to
DISM /online /Get-TargetEditions
Determine the current edition name
DISM /online /Get-CurrentEdition
nter the new edition name and corresponding retail product key
DISM /online /Set-Edition:<target edition> /ProductKey:<product key> /AcceptEula

Shortcut to Run Computer management

compmgmt.msc

Windows System UI Languages

To See System Default UI Language of Windows 10 in PowerShell
Get-Culture | Format-List -Property *
To See System Default UI Language of Windows 10 in Command Prompt (as admin)
dism /online /get-intl

To See System Default and Installed Language of Windows 10 in Registry Editor

In Registry Editor, browse to the key location below.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language

How to See Currently Logged in Users in Windows 10 / 8 / 7
query user

Check installed Windows versions 1
systeminfo
Check installed Windows versions 2
winver
Connaitre l'IP public de sortie d'une machine par command
nslookup myip.opendns.com resolver1.opendns.com
Command to reboot windows computer
shutdown /r /t 0

Change user password in Windows 10

cmd.exe in administrative mode [Windows-Logo+X].

See all Windows-10 User Accounts.
net user
Then type in the command (in this case for the administrator account):
net user administrator *
And now enter the new Windows 10 password and retype the password to confirm the password.
This creates the user account:
net user /add [username] [password]

This adds the user to the Local Administrators Group
net localgroup administrators [username] /add

How to force Windows 10 & 11 to synchronise with a clock time server?

Method 1

Press Windows key + r and type services.msc and press enter. Right click on Windows Time and select properties to check the status of the service. Restart the Windows Time service. Click on OK. Restart the computer

Method 2

Click on clock and select “Change date and time settings”. Click on the “Internet Time” tab. Check if it is set to “synchronize the time with time.windows.com” If the option is selected, click on change settings to check the option “Synchronize with an Internet Time server” Click on OK.

Method 3

Press Windows key + X and select Command prompt(Admin). Type each one of the command below and press enter.

net stop w32time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync
Restart the computer to test the issue again. W32tm.exe is used to configure Windows Time service settings. It can also be used to diagnose problems with the time service. W32tm.exe is the preferred command line tool for configuring, monitoring, or troubleshooting the Windows Time service.

How to increase or Change trust relationship time limit on domain controller

Windows Trust Relationship GPO

How to check if a windows registry key exists using powershell?

You can use the Test-Path cmdlet in PowerShell to check if a Windows registry key exists. The syntax is as follows:

Test-Path 'Registry::HKEY_LOCAL_MACHINE\Path\To\Key'
Replace 'HKEY_LOCAL_MACHINE\Path\To\Key' with the path to the registry key you want to check. If the key exists, the cmdlet will return True; if it doesn't exist, it will return False.

Verify groups

whoami /groups

Adding a domain admin

// Create a new user

net user mighty Password123! /add /domain
// Add the new user to Administrator local group
net group "Administrators" mighty /add /domain

How to prevent your users from downloading and installing Office via the Office portals

Prevent your users from downloading and installing Office

DC Server Migration

  1. Prepare Existing AD forest for server 2019 DC

Check FSMO roles location

View FSMO role holders
netdom query fsmo

More explainations

Intune registration troubleshooting

https://learn.microsoft.com/en-us/samples/azure-samples/dsregtool/dsregtool/

Pour les serveurs windows 2012: https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/troubleshoot-security-config-mgt?view=o365-worldwide#instructions-for-applying-computer-join-rule-in-aad-connect

Windows server 2012r2 MDE enrollment status: AAD Connect misconfiguration: AAD Connect misconfiguration

+----------------------------------------------------------------------+
| Tenant Details                                                       |
+----------------------------------------------------------------------+


+----------------------------------------------------------------------+
Intune Device Registration troubleshooter Tool - DSRegTool.ps1

"An error occurred while attempting to connect to server "MY-PC-NAME". Check that the Virtual Machine service is running and that you are authorized to connect to the server.

Check if the service

Restrict creation of teams

https://techlabs.blog/categories/office-365/stop-users-from-being-able-to-create-microsoft-teams

Office update installations

"C:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe" /update user displaylevel=false updatetoversion=16.0.17126.20190
check with command on line cmd which process or running task
tasklist /FI "IMAGENAME eq OfficeC2RClient.exe"

MS Teams - Clearing Cache in Teams

New location: C:\Users\%username%\AppData\Local\Packages\MSTeams_8wekyb3d8bbwe

Classic location: %appdata%\Microsoft\Teams

Fix "Can't Extend C: Drive with Unallocated Space" in Windows 10/11

alt text 1. disable Windows recovery environment

reagentc /disable
alt text 2. get the recovery partition details
diskpart
list disk
select the recovery disk
select disk 0
show all partitions on selected disk, in this case it is disk 0
list partition
select the recovery partition
select partition 4
alt text
get the partition details
detail partition
alt text

Copy the partion type and its attribut in a notepad and then delete the partition

cmd " delete partition override This will delete the recovery partition and allow you to extend the C drive alt text

  1. Re-Create a recovery partition drive of 1GB and format it as NTFS with a letter alt text alt text alt text The recovery partition is now created alt text
  2. hide the partition alt text
Lorem ipsum dolor sit amet