Fferanet
Wiki menu

Windows Commands

Open PowerShell as administrator and enter the following command:

Restart a Server

Hour Command
05:00 shutdown /r /t 18000
10:00 shutdown /r /t 36000
15:00 shutdown /r /t 54000
20:00 shutdown /r /t 72000

Restart a Remote Server

shutdown /r /m \\srv-distant /t 10powershell

Active Directory Commands

# Display the Domain Controllers
nltest /dclist:%USERDOMAIN%

# Display DC synchronization status
repadmin /replsumpowershell

Terminal Services Commands

# Show users and login time
query user

# Show connected sessions
query session

# Disconnect the user's session by ID
reset session [ID]powershell

NTP Resynchronization

Server

net stop w32time
w32tm /config /manualpeerlist:"time.windows.com,0x8 fr.pool.ntp.org,0x8" /syncfromflags:MANUAL /reliable:yes
net start w32time
w32tm /resync
w32tm /query /statuspowershell

Client

w32tm /config /syncfromflags:domhier /update
net stop w32time && net start w32timepowershell

Disable BitLocker

Open PowerShell as administrator and enter the following command:

Disable-Bitlocker -MountPoint "C:"powershell

Delete a Network Drive

Delete the following key in the registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2powershell

Delete Administrative Shares on Windows 10

Delete the following registry key:

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v AutoShareWks /t REG_DWORD /d 0 /freg

Restart the service:

Restart-Service LanmanServer -Forcepowershell

Add Alias Function PowerShell

Create or Edit PowerShell Profile

New-Item -ItemType File -Path $PROFILE -Forcepowershell
notepad $PROFILEpowershell

Add Alias Function

function monscript {
    & "C:\Scripts\mon_script.ps1"
}powershell

Reload Profile

. $PROFILEpowershell