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
#Set file paths for later use | |
$BackupFolder = "ServerName\ShareName" # use a valid path like "\\Server01\Backups\DNSBackup" | |
$DNSServer = "ServerName" | |
$Credential = Get-PSCredential | |
# connect to DC as another user | |
$CIMSession = New-CimSession -ComputerName $DNServer -credential $Credential #Use MS Secret Mgmt to manage your credentials | |
#Read DNS info from DC | |
$ShortDate = Get-Date -Format "yyyy-MM-dd" |
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
Describe "Local Machine Health Check" { | |
$date = Get-Date | |
Context "Hardware Health Checks" { | |
It "C Drive has more than 1 GB free" { | |
$diskinfo = Get-CimInstance win32_volume | Where-Object { $_.driveletter -like 'c:' } | |
$DiskFreeSpace = $([math]::round((($diskinfo.FreeSpace)/1GB),0)) | |
$DiskFreeSpace | Should BeGreaterThan 1 | |
} |
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
#Requires -Module NameIT | |
function New-PassPhrase { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[int] | |
$MinPasswordLength = 10, | |
[Parameter()] |
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 prompt { | |
#Assign Windows Title Text | |
$host.ui.RawUI.WindowTitle = "Current Folder: $pwd" | |
#Configure current user, current folder and date outputs | |
$CmdPromptCurrentFolder = Split-Path -Path $pwd -Leaf | |
$CmdPromptUser = [Security.Principal.WindowsIdentity]::GetCurrent(); | |
$Date = Get-Date -Format 'dddd hh:mm:ss tt' |
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-NestedGroup { | |
<# | |
.SYNOPSIS | |
Gets a list of nested groups inside an Active Directory group | |
.DESCRIPTION | |
Gets a list of nested groups inside an Active Directory group using LDAPFilter. Checks for | |
two levels of nested groups from the parent group. | |
.PARAMETER Group | |
The name of an Active Directory group |
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-ADObjectOwner { | |
<# | |
.SYNOPSIS | |
Retrieves the owner information of an object from Active Directory | |
.DESCRIPTION | |
Retrieves the owner information of an object from Active Directory. Can find the owner info for a user, | |
computer, group or diistinguished name. |