This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Rename-PC{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$false)] | |
[string]$OldPCName, | |
[Parameter(Mandatory=$false)] | |
[string]$NewPCName, | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Parses the netlogon.log on DC's to find where there are client logins but no AD Sites and Services Subnet. | |
.DESCRIPTION | |
'# WIP' Means it is still a Work In Progress | |
################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://social.technet.microsoft.com/Forums/windows/en-US/fb7ceef5-0048-4e80-826e-730cb3744c48/powershell-counting-all-ad-departments?forum=ITCG | |
# Get a Unique List of Departments from AD | |
$Output = "C:\SCRIPTS\AD\Department\Department_Count.txt" | |
if (!(Test-Path -Path $Output) ){ | |
# Create a directory if it doesn't exist based on the $Output minus the file name | |
New-Item (Split-Path -Path $Output -Parent) -ItemType Directory | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Desktops{ | |
# Includes Disabled Desktops | |
Get-ADComputer -Filter * -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 | | |
Where-Object {($_.OperatingSystem -like "Windows*") -and ($_.OperatingSystem -notlike "Windows Server*")} | | |
Select-Object Name,Enabled,OperatingSystem | Sort-Object Name | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DesktopOS{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$ComputerName | |
) | |
Get-ADComputer -Filter {Name -eq $ComputerName} -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DesktopsOS { | |
"`r" | |
$PCs = Get-ADComputer -Filter * -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 | | |
Where-Object {($_.OperatingSystem -like "Windows*") -and ($_.OperatingSystem -notlike "Windows Server*")} | | |
Select-Object Name,Enabled,OperatingSystem | Sort-Object Name | |
$UniquePCs = ($PCs | Where {($_.Enabled -eq $true)}).OperatingSystem | Sort-Object | Get-Unique -AsString | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Servers { | |
# Includes Disabled Servers | |
Get-ADComputer -Filter * -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 | | |
Where-Object {$_.OperatingSystem -like "Windows Server*"} | Select-Object Name,Enabled,OperatingSystem | Sort-Object Name | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-NonWindowsOS { | |
# Includes Disabled Servers and "Hyper-V Server*" | |
Get-ADComputer -Filter * -Properties Name,OperatingSystem,OperatingSystemVersion,Enabled -ResultSetSize 1000000 | | |
Where-Object {$_.OperatingSystem -notlike "Windows*"} | | |
Select-Object Name,Enabled,OperatingSystem,OperatingSystemVersion | Sort-Object Name | FT -AutoSize | |
# ,OperatingSystemHotfix,OperatingSystemServicePack | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ServerOS{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$Server | |
) | |
Get-ADComputer -Filter {Name -eq $Server} -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 | | |
Where-Object {$_.OperatingSystem -like "Windows Server*"} | Select-Object Name,Enabled,OperatingSystem | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ServersOS { | |
Write-Output "Enabled Computer Accounts Only" | |
$Servers = Get-ADComputer -Filter * -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 | | |
Where-Object {$_.OperatingSystem -like "Windows Server*"} | Select-Object Name,Enabled,OperatingSystem | Sort-Object Name | |
( $Servers | Where {($_.Enabled -eq $true)} ).OperatingSystem | Sort-Object | Get-Unique -AsString | |
} |
OlderNewer