update
This commit is contained in:
9
windows/certutil.md
Normal file
9
windows/certutil.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Certutil
|
||||
|
||||
Certutil.exe is a command-line program for Windows, installed as part of Certificate Services. You can use certutil.exe to dump and display certification authority (CA) configuration information, configure Certificate Services, backup and restore CA components, and verify certificates, key pairs, and certificate chains.
|
||||
|
||||
---
|
||||
## WIP
|
||||
|
||||
`certutil -addstore -f "ROOT" new-root-certificate.crt`
|
||||
`certutil -delstore "ROOT" serial-number-hex`
|
30
windows/chocolatey.md
Normal file
30
windows/chocolatey.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Chocolatey
|
||||
Chocolatey is a machine-level, command-line package manager and installer for Windows software.
|
||||
|
||||
Project Homepage: [Chocolatey Homepage](https://chocolatey.org)
|
||||
|
||||
---
|
||||
## Installation
|
||||
|
||||
1. Check the Execution Policy
|
||||
|
||||
Run `Get-ExecutionPolicy`. If it returns `Restricted`, then run `Set-ExecutionPolicy AllSigned` or `Set-ExecutionPolicy Bypass -Scope Process`.
|
||||
|
||||
2. Install Chocolatey
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
```
|
||||
|
||||
3. Check if you install chocolatey
|
||||
|
||||
```powershell
|
||||
choco -?
|
||||
```
|
||||
|
||||
---
|
||||
## Install software package
|
||||
|
||||
```powershell
|
||||
choco install <package>
|
||||
```
|
55
windows/environment-variables-in-windows.md
Normal file
55
windows/environment-variables-in-windows.md
Normal file
@ -0,0 +1,55 @@
|
||||
# Environment Variables in Windows
|
||||
|
||||
## How to use them in PowerShell
|
||||
Environment Varaibles can be used in [PowerShell](windows/powershell.md) with the prefix `$env:`.
|
||||
|
||||
**Example***:
|
||||
*Variable:* `%APPDATA%`
|
||||
*In Powershell:* `$env:APPDATA`
|
||||
|
||||
## List of environment variables
|
||||
Variable | Description
|
||||
---|---
|
||||
`%ALLUSERSPROFILE%`|C:\ProgramData
|
||||
`%APPDATA%`|C:\Users\{username}\AppData\Roaming
|
||||
`%COMMONPROGRAMFILES%`|C:\Program Files\Common Files
|
||||
`%COMMONPROGRAMFILES(x86)%`|C:\Program Files (x86)\Common Files
|
||||
`%CommonProgramW6432%`|C:\Program Files\Common Files
|
||||
`%COMSPEC%`|C:\Windows\System32\cmd.exe
|
||||
`%HOMEDRIVE%`|C:\
|
||||
`%HOMEPATH%`|C:\Users\{username}
|
||||
`%LOCALAPPDATA%`|C:\Users\{username}\AppData\Local
|
||||
`%LOGONSERVER%`|\\{domain_logon_server}
|
||||
`%PATH%`|C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
||||
`%PathExt%`|.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc
|
||||
`%PROGRAMDATA%`|C:\ProgramData
|
||||
`%PROGRAMFILES%`|C:\Program Files
|
||||
`%ProgramW6432%`|C:\Program Files
|
||||
`%PROGRAMFILES(X86)%`|C:\Program Files (x86)
|
||||
`%PROMPT%`|$P$G
|
||||
`%SystemDrive%`|C:
|
||||
`%SystemRoot%`|C:\Windows
|
||||
`%TEMP%`|C:\Users\{username}\AppData\Local\Temp
|
||||
`%TMP%`|C:\Users\{username}\AppData\Local\Temp
|
||||
`%USERDOMAIN%`|Userdomain associated with current user.
|
||||
`%USERDOMAIN_ROAMINGPROFILE%`|Userdomain associated with roaming profile.
|
||||
`%USERNAME%`|{username}
|
||||
`%USERPROFILE%`|C:\Users\{username}
|
||||
`%WINDIR%`|C:\Windows
|
||||
`%PUBLIC%`|C:\Users\Public
|
||||
`%PSModulePath%`|%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\
|
||||
`%OneDrive%`|C:\Users\{username}\OneDrive
|
||||
`%DriverData%`|C:\Windows\System32\Drivers\DriverData
|
||||
`%CD%`|Outputs current directory path. (Command Prompt.)
|
||||
`%CMDCMDLINE%`|Outputs command line used to launch current Command Prompt session. (Command Prompt.)
|
||||
`%CMDEXTVERSION%`|Outputs the number of current command processor extensions. (Command Prompt.)
|
||||
`%COMPUTERNAME%`|Outputs the system name.
|
||||
`%DATE%`|Outputs current date. (Command Prompt.)
|
||||
`%TIME%`|Outputs time. (Command Prompt.)
|
||||
`%ERRORLEVEL%`|Outputs the number of defining exit status of previous command. (Command Prompt.)
|
||||
`%PROCESSOR_IDENTIFIER%`|Outputs processor identifier.
|
||||
`%PROCESSOR_LEVEL%`|Outputs processor level.
|
||||
`%PROCESSOR_REVISION%`|Outputs processor revision.
|
||||
`%NUMBER_OF_PROCESSORS%`|Outputs the number of physical and virtual cores.
|
||||
`%RANDOM%`|Outputs random number from 0 through 32767.
|
||||
`%OS%`|Windows_NT
|
9
windows/powershell-remote.md
Normal file
9
windows/powershell-remote.md
Normal file
@ -0,0 +1,9 @@
|
||||
# PowerShell Remote Access
|
||||
|
||||
|
||||
---
|
||||
## Open new Remote Session
|
||||
|
||||
```powershell
|
||||
Enter-PSSession -ComputerName <SERVER> -Credential <USERNAME>
|
||||
```
|
42
windows/powershell.md
Normal file
42
windows/powershell.md
Normal file
@ -0,0 +1,42 @@
|
||||
# PowerShell Cheat-Sheet
|
||||
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language.
|
||||
|
||||
## Install PowerShell
|
||||
PowerShell was made open-source and cross-platform with PowerShell Core, and can be installed on multiple operating systems.
|
||||
|
||||
### Windows
|
||||
1. Download MSI Package from the [Official PowerShell Docs](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2)
|
||||
2. Set up PowerShell Profile in [Windows Terminal](windows/windows-terminal.md).
|
||||
```json
|
||||
"commandline": "pwsh.exe -nologo",
|
||||
"name": "Powershell",
|
||||
"source": "Windows.Terminal.PowershellCore"
|
||||
```
|
||||
|
||||
### Linux (Ubuntu)
|
||||
```sh
|
||||
# Update the list of packages
|
||||
sudo apt-get update
|
||||
# Install pre-requisite packages.
|
||||
sudo apt-get install -y wget apt-transport-https software-properties-common
|
||||
# Download the Microsoft repository GPG keys
|
||||
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
|
||||
# Register the Microsoft repository GPG keys
|
||||
sudo dpkg -i packages-microsoft-prod.deb
|
||||
# Update the list of packages after we added packages.microsoft.com
|
||||
sudo apt-get update
|
||||
# Install PowerShell
|
||||
sudo apt-get install -y powershell
|
||||
# Start PowerShell
|
||||
pwsh
|
||||
```
|
||||
|
||||
## Profile
|
||||
Set up a PowerShell Profile by opening the profile script :
|
||||
```powershell
|
||||
code $PROFILE
|
||||
```
|
||||
|
||||
## (Optional) Set up starship Prompt
|
||||
You can customize the look and feel of PowerShell with the Starship Prompt ([[starship]]).
|
||||
|
39
windows/windows-dns-server.md
Normal file
39
windows/windows-dns-server.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Windows DNS Server
|
||||
|
||||
In Windows Server, DNS is a server role that you can install by using Server Manager or Windows PowerShell commands. If you are installing a new Active Directory forest and domain, DNS is automatically installed with Active Directory as the Global Catalogue server for the forest and domain.
|
||||
|
||||
---
|
||||
## Install Windows DNS Server role
|
||||
```powershell
|
||||
Install-WindowsFeature -Name DNS -IncludeManagementTools
|
||||
```
|
||||
|
||||
---
|
||||
## Manage DNS Server via PowerShell
|
||||
|
||||
**List available DNS Servers**
|
||||
```powershell
|
||||
Get-Module DNSServer -ListAvailable
|
||||
```
|
||||
|
||||
**Show current DNS Records in Zone**
|
||||
```powershell
|
||||
Get-DnsServerResourceRecord -ZoneName <your-dns-zone>
|
||||
```
|
||||
|
||||
### Get/Create/Modify DNS Record
|
||||
|
||||
**Show DNS Record**
|
||||
```powershell
|
||||
Get-DnsServerResourceRecord -ZoneName <your-dns-zone> -Name <dns-name>
|
||||
```
|
||||
|
||||
**Delete DNS Record**
|
||||
```powershell
|
||||
Get-DnsServerResourceRecord -ZoneName <your-dns-zone> -Name <dns-name> | Remove-DnsServerResourceRecord -ZoneName <your-dns-zone>
|
||||
```
|
||||
|
||||
**Add DNS Record**
|
||||
```
|
||||
Add-DnsServerResourceRecordA -Name <dns-name> -ZoneName <your-dns-zone> -AllowUpdateAny -IPv4Address <ip-address> -TimeToLive <ttl>
|
||||
```
|
17
windows/windows-server-rearm.md
Normal file
17
windows/windows-server-rearm.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Windows Server Evaluation Rearm
|
||||
|
||||
Windows Server Evaluations are valid for 180 days. After that period, the server will need to be rearmed a few times. This is useful for testing purposes, and extending the evaluation period for additional 180 days.
|
||||
|
||||
## View Windows Server Evaluation Status
|
||||
|
||||
```powershell
|
||||
slmgr /dlv
|
||||
```
|
||||
|
||||
## Rearm Windows Server Evaluation
|
||||
|
||||
```powershell
|
||||
slmgr /rearm
|
||||
```
|
||||
|
||||
Confirm the rearm was successful by running `slmgr /dlv` again.
|
41
windows/windows-terminal.md
Normal file
41
windows/windows-terminal.md
Normal file
@ -0,0 +1,41 @@
|
||||
## Windows Terminal.
|
||||
### Install Windows Terminal
|
||||
Windows Store: [Windows Terminal](https://aka.ms/terminal)
|
||||
### Keyboard Shortcuts
|
||||
|
||||
1. Application commands
|
||||
- ALT - F4: Close window
|
||||
- CTRL - SHIFT - F: Find
|
||||
- CTRL - SHIFT - SPACE: Open dropdown
|
||||
- CTRL - ,: Open settings file
|
||||
- ALT - ENTER - F11: Toggle full screen
|
||||
|
||||
2. Tab commands
|
||||
- CTRL - SHIFT - D: Duplicate tab
|
||||
- CTRL - SHIFT - T: New tab
|
||||
- CTRL - SHIFT - P: New tab from profile p=1..9
|
||||
- CTRL - TAB: Switch to next tab
|
||||
- CTRL - SHIFT - TAB: Switch to prev tab
|
||||
- CTRL - ALT - N: Switch to tab n=0..9
|
||||
|
||||
3. Pane commands
|
||||
- ALT - SHIFT - D: Split pane optimally. Active profile
|
||||
- ALT - SHIFT - -: Split pane horizontally. Default profile
|
||||
- ALT - SHIFT - +: Split pane vertically. Default profile
|
||||
- ALT - SHIFT - ARROWS: Resize pane
|
||||
- ALT - ARROWS: Move pane focus
|
||||
- CTRL - SHIFT - W: Close innermost pane, tab, or window
|
||||
|
||||
4. Clipboard commands
|
||||
- CTRL - C: Copy
|
||||
- CTRL - V: Paste
|
||||
|
||||
5. Scrollback commands
|
||||
- CTRL - SHIFT - UP: Scroll up
|
||||
- CTRL - SHIFT - DOWN: Scroll down
|
||||
- CTRL - SHIFT - PGUP: Scroll page up
|
||||
- CTRL - SHIFT - PGDN: Scroll page down
|
||||
6. Visual adjustment commands
|
||||
- CTRL - =: Increase font size
|
||||
- CTRL - -: Decrease font size
|
||||
- CTRL - 0: Reset font size
|
18
windows/windows-updates.md
Normal file
18
windows/windows-updates.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Windows Updates
|
||||
|
||||
|
||||
---
|
||||
## PowerShell
|
||||
### Install Windows Update
|
||||
```powershell
|
||||
Install-Module -Name PSWindowsUpdate
|
||||
```
|
||||
### List all Commands
|
||||
```powershell
|
||||
Get-Command -module PSWindowsUpdate
|
||||
```
|
||||
|
||||
```powershell
|
||||
Get-WUInstall
|
||||
```
|
||||
|
Reference in New Issue
Block a user