Windows
-------- installing a package ----------- msiexec.exe /i "C:\example.msi" File History: ------------- Is there anyway to set up File history (Backup locations and activate FH) via Powershell Only. -------------------------------------------------------------------------------------------- Show-ControlPanelItem -CanonicalName "Microsoft.FileHistory" Which opens the file history control panel screen ------------------------------------------------- Get-ControlPanelItem --------Checking WinSxS folder size------------- Dism /Online /Cleanup-Image /AnalyzeComponentStore --------Cleaning up WinSxS folder---------------- Dism /online /Cleanup-Image /StartComponentCleanup ----------------Weather Check-------------------- Invoke-RestMethod http://wttr.in/Toronto -------------------Checking Winodws firewall Profile ---------------------------- Get-NetFirewallProfile | Format-Table Name, Enabled ----------Disable Windows Firewall in Windows Server 2012/2016/2019 Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled False ----------Enable Windows Defender Firewall with Advanced Security -----Netsh: netsh advfirewall set allprofiles state on perfmon /res|report|rel|sys Sending email via powershell command from internal : ---------------------------------------------------- Send-MailMessage -From 'test@ind.ca ' -To 'sam@gmail.com ' -Subject 'Test mail' -Body 'Test mail' -BodyAsHtml -SmtpServer mx1.ind.corp -Port 25 pathping /n gateway.zscaler.net | Out-GridView -PassThru | Export-Csv -Path .\pathping .csv Get-Process winlogon | Format-List -Property * Dism /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:X:\sources\sxs ----------------Dism tool can list out the installed Windows Update CBS packages:------------------------ Dism /online /get-packages | clip ------ The output is redirected to clipboard (using | clip operator) Open Notepad and paste the contents from clipboard (Ctrl + V) Clear the WINS database nbtstat -RR -------------------------------------FreeVirtualMemory--------------------------------------------------------------- Get-WmiObject -Class Win32_OperatingSystem –ComputerName localhost |Select-Object -Property CSName,FreeVirtualMemory N More Command Systeminfo | find /i "Boot time" Perfmon /res|report|rel|sys resmon slmgr.vbs -ipk slmgr -rearm ----- You can rearm the period 6 times. (180 days * 6 = 3 years) slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx cscript c:\windows\system32\slmgr.vbs /ipk %WINDIR%\system32\sysprep\sysprep.exe Qwinsta --- is a synonym for QUERY SESSION Remove-WindowsFeature -Name "MSMQ" -Restart installing telnet -- servermanagercmd -i telnet-client Query pagefile -- systeminfo | find "Virtual Memory" pathping /n gateway.zscaler.net | Out-GridView -PassThru | Export-Csv -Path .\pathping .csv Diskpart --> Delete partition override Run the Hardware and Device Troubleshooter In the Start menu search bar, search for the command prompt and select Run as administrator. Type msdt.exe -id DeviceDiagnostic. PSR.exe Get-ComputerInfo -Property CsProcessors Hold CTrl and shift together then click on cmd icon after you search it . Get-AppxPackage *edge* Remove-AppxPackage Microsoft.MicrosoftEdge.Stable_93.0.961.38_neutral__8wekyb3d8bbwe rename *.shn *.wav # Get the current user's FQDN whoami /fqdn # Get the current user's UPN whoami /upn Get Logged On User ??? list the sessions on DC1 qwinsta /server:dc1 quser /server:dc1 taskschd.msc wf.msc New-netfirewallrule enable-netfirewallrule dsadd.exe Optimizing Virtual Machines memory in Hyper-V --> Memory Buffer