PowerShell Script: Listing Windows Files Over 1GB

To list Windows files over 1GB, we can utilize the Get-ChildItem cmdlet, which retrieves files and folders from a specified location. We will combine it with the Where-Object cmdlet, which filters the results based on a specified condition. The condition, in this case, will be the file size being greater than 1 gigabyte. Here’s an example of a PowerShell script that accomplishes this task: $folderPath = “C:” Get-ChildItem -Path $folderPath…

How to Change RDP port in Windows Server via Powershell CLI

Open Powershell as Administrator Change RDP port: Set-ItemProperty -Path “HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\” -Name PortNumber -Value 3391 Check current port: (Get-ItemProperty -Path “HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\” -Name PortNumber).PortNumber  

Disable Windows Server Update via Powershell/CLI

Create a file with notepad and paste below code, rename file as disable_update.ps1 then open Powershell as Admin then run it ./ps1 $WUSettings = (New-Object -com “Microsoft.Update.AutoUpdate”).Settings $WUSettings.NotificationLevel=1 $WUSettings.save() $WindowsUpdatePath = “HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\” $AutoUpdatePath = “HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU” If(Test-Path -Path $WindowsUpdatePath) { Remove-Item -Path $WindowsUpdatePath -Recurse } New-Item -Path $WindowsUpdatePath New-Item -Path $AutoUpdatePath Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1