Month: January 2023

How to Install PowerShell Module on An Offlined Computer

# Download the desired module onto a 'jump host' (an intermediary computer that has access…

PowerShell: Uninstall Program Using Its Name

# uninstallProgramUsingId.ps1 $appName='Virtual Machine Manager Agent' $uninstallStringRegPaths='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' $uninstallStrings=Get-ChildItem -Path $uninstallStringRegPaths $uninstallString=($uninstallStrings|Get-ItemProperty|Where-Object {$_.DisplayName -match $appName}).UninstallString if($uninstallString.count…

PowerShell: Get Connected Port by Process Name

# getProcessConnectionPort.ps1 $computerlist=@' SQL1 SQL2 '@ $computernames=@($computerList -split "`n")|%{$_.Trim()} $processname='sqlservr' $state='Established' $results=@() foreach ($computername in…

PowerShell: Quickly Test Connectivity from a List of Sources toward a Destination on a Specific Port

# testRemotePort.ps1 $connectFrom=@' windows1 windows2 '@ $connectTo=@' \\servername\sharename '@ $testPort=445 $sources=@($connectFrom -split "`n")|%{$_.Trim()} $destinations=@($connectTo -split…

How To Recover SQLSERVER Service from Being Unable to Start

# startSqlService.ps1 # special provision to deal with SQL Server not starting up due to…

PowerShell: How to Change Guest VM Names in Virtual Machine Manager

# changeGuessVmNameInVmm.ps1 # The following script prepend all VM's matching certain pattern # This is…

Resume All Guest VMs in a Clustered Hyper-V Environment

# resumeAllVms.ps1 # Significance: this script is useful in a Clustered Hyper-V environment # where…

PowerShell: Command to Retrieve Windows Applications List

The following the the PoSH equivalent of appwiz.cpl in Windows: PS> invoke-command TestWindows {Get-Package -Provider…

Linux Cheat Sheet

Below is a quick reference to the most useful commands and techniques for a Linux…

How to Search for Installed Application by Name in PowerShell

One can search using the known Vendor or application Name as illustrated below: [testwindows]: PS…

PowerShell: Create Registry Keys within Windows Localhost

# createRegKey.ps1 $regKeys=@( @{ hive='REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome'; name='ChromeCleanupEnabled'; value=0 } @{ hive='REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome'; name='ChromeCleanupReportingEnabled'; value=0 } ) function…

Windows: How to Map Network Drive for All Users of a Local Machine

# Mapping file share using legacy commands (more effective than newer PowerShell equivalents in certain…