Skip to content

Instantly share code, notes, and snippets.

9to5IT 9to5IT

Block or report user

Report or block 9to5IT

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@9to5IT
9to5IT / Manage-ADOUs.ps1
Created Jul 4, 2016
PowerShell: Cleanup empty AD OUs
View Manage-ADOUs.ps1
Import-Module ActiveDirectory
#-------------------------------
# FIND EMPTY OUs
#-------------------------------
# Get empty AD Organizational Units
$OUs = Get-ADOrganizationalUnit -Filter * | ForEach-Object { If ( !( Get-ADObject -Filter * -SearchBase $_ -SearchScope OneLevel) ) { $_ } } | Select-Object Name, DistinguishedName
#-------------------------------
@9to5IT
9to5IT / Manage-ADGroups.ps1
Created Jul 4, 2016
PowerShell: Cleanup empty AD Groups
View Manage-ADGroups.ps1
Import-Module ActiveDirectory
#-------------------------------
# FIND EMPTY GROUPS
#-------------------------------
# Get empty AD Groups within a specific OU
$Groups = Get-ADGroup -Filter { Members -notlike "*" } -SearchBase "OU=GROUPS,DC=testlab,DC=com" | Select-Object Name, GroupCategory, DistinguishedName
#-------------------------------
@9to5IT
9to5IT / Manage-ADComputers.ps1
Created Jul 4, 2016
PowerShell: Cleanup inactive AD computer objects
View Manage-ADComputers.ps1
Import-Module ActiveDirectory
# Set the number of days since last logon
$DaysInactive = 90
$InactiveDate = (Get-Date).Adddays(-($DaysInactive))
#-------------------------------
# FIND INACTIVE COMPUTERS
#-------------------------------
# Below are three options to find inactive computers. Select the one that is most appropriate for your requirements:
@9to5IT
9to5IT / Manage-ADUsers.ps1
Created Jul 4, 2016
PowerShell: Cleanup Inactive AD User Accounts
View Manage-ADUsers.ps1
Import-Module ActiveDirectory
# Set the number of days since last logon
$DaysInactive = 90
$InactiveDate = (Get-Date).Adddays(-($DaysInactive))
#-------------------------------
# FIND INACTIVE USERS
#-------------------------------
# Below are four options to find inactive users. Select the one that is most appropriate for your requirements:
@9to5IT
9to5IT / Find-RegistryValues.ps1
Created Jun 23, 2016
PowerShell: Enumerate & Search Registry Key values with PowerShell
View Find-RegistryValues.ps1
$RegKey = (Get-ItemProperty 'HKCU:\Volatile Environment')
$RegKey.PSObject.Properties | ForEach-Object {
If($_.Name -like '*View*'){
Write-Host $_.Name ' = ' $_.Value
}
}
@9to5IT
9to5IT / Set-HostSNMP.ps1
Created Jun 7, 2016
PowerShell: Configure SNMP on an ESXi Host
View Set-HostSNMP.ps1
#requires -version 4
<#
.SYNOPSIS
Configure SNMP Settings on ESXi Hosts
.DESCRIPTION
Connect to vCenter Server and configure all ESXi hosts with SNMP settings
.PARAMETER None
@9to5IT
9to5IT / Get-RDM.ps1
Last active Aug 22, 2018
PowerShell: Searching for RDM disks using PowerCLI
View Get-RDM.ps1
#requires -version 4
<#
.SYNOPSIS
Seaches for an RDM with the specified LUN ID.
.DESCRIPTION
Searches the vCenter environment to find the Virtual Machine that has an RDM configured with a particular LUN ID.
.PARAMETER None
@9to5IT
9to5IT / PowerCLI_Script_Template_V2_NoLogs.ps1
Last active Jun 11, 2019
PowerShell: PowerCLI Script Template Version 2 (without logging)
View PowerCLI_Script_Template_V2_NoLogs.ps1
#requires -version 4
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@9to5IT
9to5IT / PoweCLI_Script_Template_V2_Logs.ps1
Last active Jul 17, 2016
PowerShell: PowerCLI Script Template Version 2 (with logging)
View PoweCLI_Script_Template_V2_Logs.ps1
#requires -version 4
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@9to5IT
9to5IT / PS_Script_Template_V2_NoLogs.ps1
Last active May 9, 2019
PowerShell: Script Template Version 2 (without logging)
View PS_Script_Template_V2_NoLogs.ps1
#requires -version 4
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
You can’t perform that action at this time.