Difference between revisions of "IT-OS-Admin-Winodws"

From wiki.samerhijazi.net
Jump to navigation Jump to search
(WSL)
(Partion-Manager)
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=Ref.=
 +
* https://docs.microsoft.com/en-us/windows/wsl/install
 +
* https://docs.microsoft.com/en-us/windows/wsl/faq
 +
 
=Mix=
 
=Mix=
 +
 +
==Tools==
 +
*https://winaero.com/download-universal-watermark-disabler/
 +
==Activating Windows==
 +
<pre class="code">
 +
slmgr.vbs -xpr
 +
wmic path SoftwareLicensingService get OA3xOriginalProductKey
 +
</pre>
 +
 
==RegEdit==
 
==RegEdit==
 
* https://www.wintools.info/index.php/classic-color-panel
 
* https://www.wintools.info/index.php/classic-color-panel
Line 17: Line 30:
 
* REG: https://www.howtogeek.com/222057/how-to-remove-the-folders-from-%E2%80%9Cthis-pc%E2%80%9D-on-windows-10/
 
* REG: https://www.howtogeek.com/222057/how-to-remove-the-folders-from-%E2%80%9Cthis-pc%E2%80%9D-on-windows-10/
 
<pre class="code">
 
<pre class="code">
C:\> net use                                       # List mapped network drives.
+
C:\> arp -a                          ### ARP stands for “Address Resolution Protocol” is a protocol for mapping an IP address to a physical MAC address on a local area network.
C:\> netsh winhttp show proxy                     # lists system-proxy
+
C:\> shutdown /f /r /t 0              ### F: Force running applications to close; R: Full shutdown and restart the computer; T: Set the time-out period before shutdown to xxx seconds.
 +
C:\> powercfg /h off                  ### disable Hibernation entirely
 +
C:\> net use                         ### List mapped network drives.
 +
C:\> netsh winhttp show proxy         ### lists system-proxy
 
C:\> doskey np=notepad++.exe $*
 
C:\> doskey np=notepad++.exe $*
 
C:\> netstat -ano | find "5005"
 
C:\> netstat -ano | find "5005"
 
C:\> taskkill /F /PID 1196
 
C:\> taskkill /F /PID 1196
 
C:\> mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"          # Symbolic Links
 
C:\> mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"          # Symbolic Links
 +
 +
--------------------------------------------------------------------------------------------
 +
dir /b /a-d # List filenames without path.
 +
dir /b /a-d /s # List filenames with path.
 
</pre>
 
</pre>
  
 +
=RegEdit=
 +
* Computer\HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32
 
=Windows-Terminal=
 
=Windows-Terminal=
 
* https://docs.microsoft.com/en-us/windows/terminal/
 
* https://docs.microsoft.com/en-us/windows/terminal/
Line 30: Line 52:
 
* https://windowsloop.com/add-open-windows-terminal-here-option-to-right-click-menu/
 
* https://windowsloop.com/add-open-windows-terminal-here-option-to-right-click-menu/
 
* https://github.com/dracula/windows-terminal
 
* https://github.com/dracula/windows-terminal
 +
 
=Hyper-V=
 
=Hyper-V=
 
<pre class="code">
 
<pre class="code">
Line 38: Line 61:
 
=WSL=
 
=WSL=
 
==Ref.==
 
==Ref.==
* https://docs.microsoft.com/en-us/windows/wsl/
+
* https://learn.microsoft.com/en-us/windows/wsl/
 +
* https://canonical-ubuntu-wsl.readthedocs-hosted.com/en/latest/
 
* https://fedoramagazine.org/wsl-fedora-33/
 
* https://fedoramagazine.org/wsl-fedora-33/
 
* https://github.com/sirredbeard/Awesome-WSL
 
* https://github.com/sirredbeard/Awesome-WSL
 
* https://dev.to/bowmanjd/install-fedora-on-windows-subsystem-for-linux-wsl-4b26
 
* https://dev.to/bowmanjd/install-fedora-on-windows-subsystem-for-linux-wsl-4b26
 
* https://www.kali.org/docs/wsl/win-kex/
 
* https://www.kali.org/docs/wsl/win-kex/
==Mix==
+
* https://www.windowscentral.com/how-install-ubuntu-2110-wsl-windows-10-and-11
 +
 
 +
==Pre==
 +
<pre class="code">
 +
Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")
 +
</pre>
 +
==Settings==
 +
<pre class="code">
 
* Reset wsl: Settings -> Apps -> Apps & features
 
* Reset wsl: Settings -> Apps -> Apps & features
==cli==
+
* Location: %USERPROFILE%\AppData\Local\Packages\%NAME_DISTRO%\LocalState
 +
* Location: C:\Users\{your_username}\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_{random_characters}\LocalState
 +
</pre>
 
<pre class="code">
 
<pre class="code">
$ wsl -l                                        # Lists distributions.
+
  "colorScheme": "Dracula",
$ wsl -s distro-name                            # Sets the distribution as the default.
+
  "commandline": "C:\\WINDOWS\\system32\\wsl.exe -d Ubuntu-22.04",
$ wsl -d distro-name                            # Run the specified distribution.
+
  "guid": "{1946189d-1894-46e8-81e4-7d9c83f32014}",
$ wsl -u user                                    # Run as the specified user.
+
  "hidden": false,
$ wsl --unregister distro-name                  # Unregisters the distribution.
+
  "icon": "https://assets.ubuntu.com/v1/49a1a858-favicon-32x32.png",
$ wsl --export distro-name file-name            # Exports the distribution to a tar file.
+
  "name": "Ubuntu-22.04.01_LTS",
$ wsl --import distro-name location file-name   # Imports the specified tar file as a new distribution.
+
  "startingDirectory": "~",
 +
   "suppressApplicationTitle": true
 
</pre>
 
</pre>
 +
 
==/etc/wls.conf==
 
==/etc/wls.conf==
 
<pre class="code">
 
<pre class="code">
Line 67: Line 102:
 
==Distros==
 
==Distros==
 
<pre class="code">
 
<pre class="code">
 +
https://aka.ms/wsluseres
 
https://aka.ms/wslubuntu2004
 
https://aka.ms/wslubuntu2004
 
https://aka.ms/wsl-ubuntu-1804
 
https://aka.ms/wsl-ubuntu-1804
Line 76: Line 112:
 
</pre>
 
</pre>
  
==Ubuntu==
+
==Commands==
* https://wiki.ubuntu.com/WSL
+
<pre class="code">
 +
wsl -- help                                              # Display usage information.
 +
wsl -l --verbose                                          # Lists all distributions with versions.
 +
wsl -l --online                                          # Displays a list of available distributions for install
 +
wsl --install <NAME_DISTRO>                              # Install a Windows Subsystem for Linux distribution.
 +
wsl -s $NAME_DISTRO                                      # Sets default distribution.
 +
wsl -d $NAME_DISTRO                                      # Run with specified distribution.
 +
wsl -u user                                              # Run with specified user.
 +
wsl --unregister $NAME_DISTRO                            # Unregisters the distribution and deletes the root filesystem.
 +
-----------------------------------------------------------
 +
wsl --shutdown                                            # Immediately terminates all running distributions and the WSL 2
 +
wsl --status
 +
-----------------------------------------------------------
 +
wsl --export <distro> <filename.tar>                      # Exports the distribution to a tar file.
 +
wsl --import <distro> <InstallLocation> <filename.tar>    # Imports the specified tar file as a new distribution.
 +
</pre>
 +
 
 +
==CMD==
 
<pre class="code">
 
<pre class="code">
wsl --unregister Ubuntu-18.04
+
do-release-upgrade
wsl --export Ubuntu-18.04 Ubuntu-18.04.tar
 
wsl --import Ubuntu-Fabric ./Ubuntu-Fabric ./Ubuntu-18.04.tar
 
wsl -d Ubuntu-Fabric                                               
 
 
</pre>
 
</pre>
  
Line 89: Line 139:
 
* https://dev.to/bowmanjd/install-fedora-on-windows-subsystem-for-linux-wsl-4b26
 
* https://dev.to/bowmanjd/install-fedora-on-windows-subsystem-for-linux-wsl-4b26
 
<pre class="code">
 
<pre class="code">
wget https://github.com/fedora-cloud/docker-brew-fedora/blob/33/x86_64/fedora-33.20201230-x86_64.tar.xz
 
 
wget https://github.com/fedora-cloud/docker-brew-fedora/raw/34/x86_64/fedora-34.20210424-x86_64.tar.xz
 
wget https://github.com/fedora-cloud/docker-brew-fedora/raw/34/x86_64/fedora-34.20210424-x86_64.tar.xz
wget https://raw.githubusercontent.com/fedora-cloud/docker-brew-fedora/34/x86_64/fedora-34.20210424-x86_64.tar.xz
+
wget https://github.com/fedora-cloud/docker-brew-fedora/raw/35/x86_64/fedora-35.20211125-x86_64.tar.xz
xz --decompress fedora-33.20201230-x86_64.tar.xz
+
xz --decompress fedora-xx.yyymmdd-x86_64.tar.xz
wsl --import Fedora-33 ./Fedora-33 ./fedora-33.tar
+
wsl --import Fedora-xx ./Fedora-xx ./fedora-xx.tar
wsl -d Fedora-33
+
wsl -d Fedora-xx
 
</pre>
 
</pre>
 
<pre class="code">
 
<pre class="code">
Line 116: Line 165:
 
sudo dnf copr enable trustywolf/wslu
 
sudo dnf copr enable trustywolf/wslu
 
</pre>
 
</pre>
 +
=Installing Apps with Shell=
 +
* https://store.rg-adguard.net/
 +
* https://www.microsoft.com/en-us/p/Windows-Terminal/9N0DX20HK701
 +
<pre class="code">
 +
C:\Program Files\WindowsApps
 +
C:\Windows\SystemApps
 +
---------------------------------
 +
get-appxpackage | Out-GridView
 +
get-appxpackage | sort-object -Property PackageFullName | select packagefullname | out-gridview
 +
get-appxPackage | Out-GridView -Passthru | Remove-AppXPackage
 +
---------------------------------
 +
Set-ExecutionPolicy Unrestricted
 +
Get-AppXPackage -allusers | Remove-AppxPackage
 +
Get-AppXPackage -allusers | Add-AppxPackage
 +
Get-AppXPackage -allusers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
 +
Get-AppxPackage -allusers *Microsoft.WindowsTerminal* | Remove-AppxPackage
 +
Add-AppxPackage -Path ".\Microsoft.WindowsTerminal_3001.12.10982.0_neutral___8wekyb3d8bbwe.appx"
 +
</pre>
 +
=Mix-Commands=
 +
<pre class="code">
 +
mdsched.exe
 +
####################################
 +
net stop wuauserv
 +
net stop cryptSvc
 +
net stop bits
 +
net stop msiserver
 +
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
 +
ren C:\Windows\System32\catroot2 catroot2.old
 +
net start wuauserv
 +
net start cryptSvc
 +
net start bits
 +
net start msiserver
 +
</pre>
 +
=Partion-Manager=
 +
* https://www.winhelponline.com/blog/resize-efi-system-partition/
 +
* https://www.partitionwizard.com/free-partition-manager.html
 +
* https://www.easeus.com/partition-manager/epm-free.html
 +
* https://www.diskpart.com/free-partition-manager.html (BEST CHOOSIE)

Latest revision as of 14:07, 23 March 2025

Ref.

Mix

Tools

Activating Windows

slmgr.vbs -xpr
wmic path SoftwareLicensingService get OA3xOriginalProductKey

RegEdit

Resetting & Update to Pro

Admin Config/tools

C:\> arp -a                           ### ARP stands for “Address Resolution Protocol” is a protocol for mapping an IP address to a physical MAC address on a local area network.
C:\> shutdown /f /r /t 0              ### F: Force running applications to close; R: Full shutdown and restart the computer; T: Set the time-out period before shutdown to xxx seconds.
C:\> powercfg /h off                  ### disable Hibernation entirely
C:\> net use                          ### List mapped network drives.
C:\> netsh winhttp show proxy         ### lists system-proxy
C:\> doskey np=notepad++.exe $*
C:\> netstat -ano | find "5005"
C:\> taskkill /F /PID 1196
C:\> mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"           # Symbolic Links

--------------------------------------------------------------------------------------------
dir /b /a-d	# List filenames without path.
dir /b /a-d /s	# List filenames with path.

RegEdit

  • Computer\HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32

Windows-Terminal

Hyper-V

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor

WSL

Ref.

Pre

Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")

Settings

* Reset wsl: Settings -> Apps -> Apps & features
* Location: %USERPROFILE%\AppData\Local\Packages\%NAME_DISTRO%\LocalState
* Location: C:\Users\{your_username}\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_{random_characters}\LocalState
   "colorScheme": "Dracula",
   "commandline": "C:\\WINDOWS\\system32\\wsl.exe -d Ubuntu-22.04",
   "guid": "{1946189d-1894-46e8-81e4-7d9c83f32014}",
   "hidden": false,
   "icon": "https://assets.ubuntu.com/v1/49a1a858-favicon-32x32.png",
   "name": "Ubuntu-22.04.01_LTS",
   "startingDirectory": "~",
   "suppressApplicationTitle": true

/etc/wls.conf

$ echo 'appendWindowsPath=False' > /etc/wsl.conf
$ /mnt/c/Windows/System32/wsl.exe --shutdown
or
c:> Restart-Service LxssManager
-----------------------------------------------------
sudo bash -c "echo 'source /etc/environment' >> /etc/profile"

Distros

https://aka.ms/wsluseres
https://aka.ms/wslubuntu2004
https://aka.ms/wsl-ubuntu-1804
https://aka.ms/wsl-ubuntu-1604
https://aka.ms/wsl-debian-gnulinux
----------------------------------------------------------------
$ curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-ubuntu-1604
$ Add-AppxPackage .\ubuntu-1604.appx

Commands

wsl -- help                                               # Display usage information.
wsl -l --verbose                                          # Lists all distributions with versions.
wsl -l --online                                           # Displays a list of available distributions for install
wsl --install <NAME_DISTRO>                               # Install a Windows Subsystem for Linux distribution.
wsl -s $NAME_DISTRO                                       # Sets default distribution.
wsl -d $NAME_DISTRO                                       # Run with specified distribution.
wsl -u user                                               # Run with specified user.
wsl --unregister $NAME_DISTRO                             # Unregisters the distribution and deletes the root filesystem.
-----------------------------------------------------------
wsl --shutdown                                            # Immediately terminates all running distributions and the WSL 2
wsl --status
-----------------------------------------------------------
wsl --export <distro> <filename.tar>                      # Exports the distribution to a tar file.
wsl --import <distro> <InstallLocation> <filename.tar>    # Imports the specified tar file as a new distribution.

CMD

do-release-upgrade

Fedora

wget https://github.com/fedora-cloud/docker-brew-fedora/raw/34/x86_64/fedora-34.20210424-x86_64.tar.xz
wget https://github.com/fedora-cloud/docker-brew-fedora/raw/35/x86_64/fedora-35.20211125-x86_64.tar.xz
xz --decompress fedora-xx.yyymmdd-x86_64.tar.xz
wsl --import Fedora-xx ./Fedora-xx ./fedora-xx.tar
wsl -d Fedora-xx
dnf update
dnf install wget curl sudo ncurses dnf-plugins-core dnf-utils passwd findutils
useradd -G irbid samer
passwd samer
exit
wsl -d Fedora-33 -u samer
-----------------------------------------------------------
$id -u
1000
$ sudo cat /etc/shadow
Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Where-Object -Property DistributionName -eq Fedora-33  | Set-ItemProperty -Name DefaultUid -Value 1000
wsl -d Fedora-33
-----------------------------------------------------------
sudo dnf copr enable trustywolf/wslu

Installing Apps with Shell

C:\Program Files\WindowsApps
C:\Windows\SystemApps
---------------------------------
get-appxpackage | Out-GridView
get-appxpackage | sort-object -Property PackageFullName | select packagefullname | out-gridview
get-appxPackage | Out-GridView -Passthru | Remove-AppXPackage
---------------------------------
Set-ExecutionPolicy Unrestricted
Get-AppXPackage -allusers | Remove-AppxPackage
Get-AppXPackage -allusers | Add-AppxPackage
Get-AppXPackage -allusers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Get-AppxPackage -allusers *Microsoft.WindowsTerminal* | Remove-AppxPackage
Add-AppxPackage -Path ".\Microsoft.WindowsTerminal_3001.12.10982.0_neutral___8wekyb3d8bbwe.appx"

Mix-Commands

mdsched.exe
####################################
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 catroot2.old
net start wuauserv
net start cryptSvc
net start bits
net start msiserver

Partion-Manager