Posted On April 8, 2019

Common Windows Maintenance using PowerShell

kimconnect 0 comments
blog.KimConnect.com >> Windows >> Common Windows Maintenance using PowerShell
# Install Windows Features:
Install-WindowsFeature SNMP-Service -IncludeManagementTools
Install-WindowsFeature -name Telnet-Client
Install-Module Posh-SSH -Force

# Disable Service:
sc config "SERVICE_NAME" start=disabled
sc stop "SERVICE_NAME"

# Disable Hibernation & activate "High Performance" power plan:
powercfg /hibernate off
powercfg /s SCHEME_MIN
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

# Test Connection on Port:
if((Test-NetConnection -ComputerName $REMOTE_SERVER -Port XXXX).tcpTestSucceeded){"execute if true"}else{"execute if false"}

# SSH:
New-SSHSession
Get-SSHSession
Remove-SSHSession

# IP to Hostname
Get-Content C:\Users\rambo\Desktop\ipList.txt | ForEach-Object {([system.net.dns]::GetHostByAddress($_)).hostname}

# Get external IP
Invoke-RestMethod ipinfo.io/ip

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to Enter the Bios on Intel NUC Portable PCs?

Normally, the F2 key upon restarting should direct the boot flow to the Visual Bios,…

PowerShell: Hyper-V Servers Capacity Report

Current Version: # HyperVCapacityReport.ps1 # Version 0.0.2 # Report parameters $workingDirectory='C:\scripts\googleSheets' $selectFields='node,model,os,cores,cpuUtilizationPercent,ramGb,ramUsedPercent' $domainObjects=@( @{domain='intranet.kimconnect.com';dc='lax-dc02.intranet.kimconnect.com';username='intranet\clusterReport';password=$env:clusterReportPass} @{domain='intranet.dragoncoin.com';dc='lax-dc02.intranet.dragoncoin.com';username='intranet\clusterReport';password=$env:clusterReportPass}…

Securing Windows Remote Desktop Services

secpol.msc > Local Policies > User Rights Assignments > double-click "Allow Log on through Remote…