Skip to content

Instantly share code, notes, and snippets.

View SweetAsNZ's full-sized avatar
🏠

Tim West SweetAsNZ

🏠
View GitHub Profile
@SweetAsNZ
SweetAsNZ / Get-VMHostManagementNetwork
Created November 8, 2022 03:00
Get ESX Host Management Network IP's
<#
.Synopsis
Connect to ESX Hosts and Get Mgt IP and Test Connectivity if requested
.DESCRIPTION
.EXAMPLE
Get-VMHostManagementNetwork -VIServer 'vc.domain1.local' -VMHost 'ESX01.domain1.local'
.EXAMPLE
Get-VMHostManagementNetwork -VIServer 'vc2.domain1.local'
#>
@SweetAsNZ
SweetAsNZ / Get-VMwareServersAndVeeamBackedUpServers.ps1
Created October 2, 2022 21:38
Compare VMware Guests and Servers Backed Up By Veeam - Get A List of Servers That Aren't Backed Up
# Query VMWare for the List of All servers and compare with Veeam backups to see coverage
$Date = ((Get-Date -Format "yyyy-MM-dd_HHmm_K").Replace(":","-").Replace("+","-")).ToString() # _$($Date).csv" _$($Date).txt" # Date for use in Filenames with TZ
function Connect-VMWare{
$Server = 'vcenter'
$VMCli = (Get-Module VMware.PowerCLI -ListAvailable).Name
if($VMCli -ne 'VMware.PowerCLI'){
<#
.Synopsis
Gets information of a port number
.DESCRIPTION
Function provides detailed information of port numbers, like - the service which use the port, Transport protocol and a small decsription.
.EXAMPLE
PS > Get-Port -Port 20,21,53
Port Service Protocol Description
---- ------- -------- -----------
@SweetAsNZ
SweetAsNZ / Remove-PhishingEmail.ps1
Last active September 14, 2022 01:39
Remove A Phishing Email From Exchange Online
function Remove-PhishingEmail
{
# "A maximum of 10 items per mailbox can be removed at one time"
# REF: https://docs.microsoft.com/en-us/microsoft-365/compliance/search-for-and-delete-messages-in-your-organization?view=o365-worldwide
#"Hard-deleted messages are marked for permanent removal from the mailbox and will be permanently removed the next time the mailbox is processed by the Managed Folder Assistant" REF: https://docs.microsoft.com/en-us/microsoft-365/compliance/search-for-and-delete-messages-in-your-organization?view=o365-worldwide
#"The goal is to process mailboxes at least once weekly. Experience is that MFA usually performs better than this and that you can expect to have mailboxes processed twice a week" REF: https://office365itpros.com/2018/12/10/reporting-the-managed-folder-assistant/
@SweetAsNZ
SweetAsNZ / Approve-WSUSLicenseAgreementAcceptance.ps1
Last active August 28, 2022 23:19 — forked from jhochwald/Approve-WSUSLicenseAgreementAcceptance.ps1
Accept License Agreements for all Windows Server Update Services (WSUS) Updates
#requires -Version 3.0 -Modules UpdateServices
<#
.SYNOPSIS
Accept License Agreements
.DESCRIPTION
Accept License Agreements for all Windows Server Update Services (WSUS) Updates
.PARAMETER Name
@SweetAsNZ
SweetAsNZ / Get-ShutdownUser.ps1
Created August 1, 2022 06:08
Get Who Shutdown A Windows Server or PC
function Get-ShutdownUser
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)]
[bool]$ShowInfo = $false,
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)]
[string]$Computer
@SweetAsNZ
SweetAsNZ / Get-UpTime.ps1
Created July 25, 2022 08:05
Get Up Time
function Get-UpTime
{
(Get-CimInstance -ClassName Win32_OperatingSystem | Select LastBootUpTime).LastBootUpTime
}
function Get-SQLServers
{
function Connect-VMWare{
#Requires -Modules 'VMware.PowerCLI'
$Server = 'vcenter.domain.local'
$VMCli = (Get-Module VMware.PowerCLI -ListAvailable).Name
@SweetAsNZ
SweetAsNZ / Get-SQLInstancesPort.ps1
Created July 15, 2022 00:58
Get SQL Servers Instances and Ports
function Get-SQLInstancesPort
{
param ([string]$Server)
# REF: https://docs.microsoft.com/en-us/answers/questions/486485/get-a-list-of-instances-and-and-port-numbers-runni.html
# $Server = 'SQL1' # TESTING
[system.reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")|Out-Null
@SweetAsNZ
SweetAsNZ / Get-WinRMServerFailures.ps1
Created July 13, 2022 22:52
Check/Test WinRM On All Domain-Joined Servers
function Get-WinRMServerFailures
{
# Ping a Server and if it responds test WINRM
$Log = 'C:\SCRIPTS\WinRM\Servers_WinRMFailed.log'
Remove-Item $Log
$Servers = (Get-ADComputer -Filter * -Properties Name,OperatingSystem,Enabled | Where {($_.Enabled -eq $true) `
-and ($_.OperatingSystem -like "Windows Server*")} | Sort Name).Name