Skip to content

Instantly share code, notes, and snippets.

@bharkr
bharkr / Create-DHCPReport.ps1
Last active March 7, 2024 16:41
Create a report on Windows DHCP servers
<#
.SYNOPSIS
Creates an Excel workbook with DHCP server information.
.DESCRIPTION
This script retrieves DHCP server summary data and subnet reservation data from the DHCP server and creates an Excel workbook with the information.
.PARAMETER SummaryData
Specifies the DHCP server summary data to be included in the workbook.
@bharkr
bharkr / Disable-TortoiseHgStartup.ps1
Last active January 8, 2024 22:56
Remove TortoiseHg from startup on a list of computers
<#
.SYNOPSIS
Disables the TortoiseHg startup entry on a list of computers.
.DESCRIPTION
The Disable-TortoiseHgStartup function uses Invoke-Command to remotely access the registry of each computer in the $ComputerName parameter. It attempts to get the 'TortoiseHgOverlayIconServer' startup entry. If the computer isn't responding or doesn't have TortoiseHg installed, it outputs a message.
.PARAMETER ComputerName
An array of computer names or a single computer name. This can be either a string or an object with a 'Name' property.
@bharkr
bharkr / Get-DhcpLeaseInfo.ps1
Last active October 2, 2023 19:18
Get-DhcpLeaseInfo
function Get-DhcpLeaseInfo {
[CmdletBinding(DefaultParameterSetName='HostName')]
param(
[Parameter(Mandatory=$true, HelpMessage='Name of the the DHCP server being queried.')]
[string]$ComputerName,
[Parameter(ParameterSetName='HostName', HelpMessage='The host name property to be queried.', Mandatory=$true)]
[string]$HostName,
[Parameter(ParameterSetName='OUI', Mandatory=$true,
HelpMessage='First three octets of the mac addresses you being searched for. For example: AA-BB-CC')]
[string]$OUI,
#requires -modules VMware.PowerCLI
$vcenterServer = ''
Connect-VIServer $vCenterServer
$virtGuests = Get-VM | Where-Object { $_.PowerState -eq 'PoweredOn' }
$vmInfoReport = @()
foreach ($guest in $virtGuests) {
@bharkr
bharkr / Install-ZabbixAgent.ps1
Last active May 29, 2024 17:54
Install Zabbix Agent Windows
function Install-ZabbixAgent {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$ComputerName,
[Parameter(Mandatory=$true)]
[string]$ZabbixUrl
)
@bharkr
bharkr / MSSQL_2016_Config.ini
Created February 17, 2022 23:59
SQL 2016 Config
; https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-using-a-configuration-file?view=sql-server-ver15
; ;SQL Server 2016 Configuration File
[OPTIONS]
ACTION="Install"
SUPPRESSPRIVACYSTATEMENTNOTICE="False"
; By specifying this parameter and accepting Microsoft R Open and Microsoft R Server terms, you acknowledge that you have read and understood the terms of use.
@bharkr
bharkr / check_remotecerts.ps1
Last active January 27, 2022 20:19
Check for Incommon Certs
$servers = @('server2','server1')
$report_csv = "C:\users\$env:username\desktop\cert_report.csv"
$Results = @()
$Results = Invoke-Command -ComputerName $Servers {
$Certs = @{} | Select Certificate,Expired
$Cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.issuer -match 'Incommon'}
If($Cert){
$Certs.Certificate = $Cert.subject
$Certs.Expired = $Cert.NotAfter