This file contains hidden or 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
$password = Get-Content C:\Scripts\Container\PoshSS.txt | ConvertTo-SecureString -Key (Get-Content C:\Scripts\Container\aes.key) | |
$VCcreds = New-Object System.Management.Automation.PsCredential("DOMAIN\SVC_ACCT",$password) | |
if($global:defaultviserver) | |
{ | |
Disconnect-VIServer -Confirm:$false -ErrorAction Ignore -Server * | |
} | |
try{ | |
Connect-VIServer tincan.DOMAIN -ErrorAction Stop -Credential $VCcreds |
This file contains hidden or 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
$folders = Get-ChildItem -Path \\SHAREPATH\ProfileUnity\ -Depth 0 -Directory | Where-Object {$_.name -ne "_ToBeDeleted"} | |
$files = New-Object System.Collections.ArrayList | |
$objTemplateObject = New-Object -TypeName psobject | |
$objTemplateObject | Add-Member -MemberType NoteProperty -Name Name -Value $null | |
$objTemplateObject | Add-Member -MemberType NoteProperty -Name Profile -Value $null | |
$objTemplateObject | Add-Member -MemberType NoteProperty -Name LastLogindDate -Value $null | |
$objTemplateObject | Add-Member -MemberType NoteProperty -Name ProfileGroup -Value $null |
This file contains hidden or 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
#Steve Landry | |
#20190705 | |
#Delete ProfileUnity user log files | |
#If log folder contains logs from more than 2 dates, the oldest files are deleted. The 2 most recent log file dates are retained | |
#Called by Scheduled Task Remove Old PU Log Files on leeroyjenkins | |
$Error.Clear() | |
Start-Transcript -Path C:\Scripts\RemoveOldPULogFiles\RemoveOldPULogFiles.log -Append -Force | |
$Header = (Get-Date -Format yyyyMMdd-HH:mm:ss.ff).ToString() + " -- INFO -- Script: " + $MyInvocation.MyCommand.Source |
This file contains hidden or 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
#Steve Landry | |
#20190705 | |
#Delete DNS log files older than 7 days | |
#Called by Scheduled Task Remove Old DNS Logsfrom DCs leeroyjenkins | |
$Error.Clear() | |
Start-Transcript -Path C:\Scripts\RemoveOldDNSLogs\RemoveOldDNsLogs.log -Append -Force | |
$Header = (Get-Date -Format yyyyMMdd-HH:mm:ss.ff).ToString() + " -- INFO -- Script: " + $MyInvocation.MyCommand.Source | |
$NotificationLog = new-object system.collections.arraylist |
This file contains hidden or 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
#This script will cycle through the organizational home folders and check to see if the acccounts they are associated with are enabled/existing | |
#Set the erro action preference | |
$ErrorActionPreference = "Stop" | |
$rootPath = "\\SHAREPATH\admin\ProfileUnity" | |
$folders = gci -Path $rootPath | Where-Object {$_.Name -notlike "_tobe*"} | Sort-Object Name | Select -ExpandProperty Name | |
#Let's go ahead and create some custom objects to store the problem children |
This file contains hidden or 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
Start-Transcript -Path "C:\Scripts\Populate-AttributeField\Populate-AttributeField.log" -Append -Force | |
$Error.Clear() | |
$Header = (Get-Date -Format yyyyMMdd-HH:mm:ss.ff).toString() + " -- INFO -- Script: " + $MyInvocation.MyCommand.Source | |
$NotificationLog = new-object system.collections.arraylist | |
. PATH\Functions\Write-ToMasterLog.ps1 | |
. PATH\Functions\Collect-Errors.ps1 | |
. PATH\Functions\Get-CurrentLine.ps1 |
This file contains hidden or 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 OU Path for organization | |
$org = "APACHE" | |
$ou = "OU=Apache,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#$org = "Test" | |
#$ou = "OU=TestOU,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#set domain controller to perform action on | |
$dc = "Apache" | |
#get domain admin credentials to make change |
This file contains hidden or 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 OU Path for organization | |
$org = "Cargo" | |
$ou = "OU=CARGO,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#$org = "Test" | |
#$ou = "OU=TestOU,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#set domain controller to perform action on | |
$dc = "Apache" | |
#get domain admin credentials to make change |
This file contains hidden or 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 OU Path for organization | |
$org = "APACHE" | |
$ou = "OU=Apache,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#$org = "Test" | |
#$ou = "OU=TestOU,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#set domain controller to perform action on | |
$dc = "Apache" | |
#get domain admin credentials to make change |
This file contains hidden or 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 OU Path for organization | |
$org = "FARA" | |
$ou = "OU=FARA,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#$org = "Test" | |
#$ou = "OU=TestOU,OU=PEOAVN,OU=PEO Aviation Users,DC=Ad,DC=DOMAIN" | |
#set domain controller to perform action on | |
$dc = "Apache" | |
#get domain admin credentials to make change |
NewerOlder