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 Test-ForPort { | |
param ( | |
[Parameter(Mandatory)] | |
[string]$Server, | |
[Parameter(Mandatory)] | |
[int]$Port, | |
[int]$RetryCount = 3, | |
[switch]$Quiet | |
) |
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-ADUserNestedMemberships { | |
param ( | |
[string]$SAMAccountName = $env:USERNAME | |
) | |
$userNestedMembership = @() | |
$domainConnection = New-Object DirectoryServices.DirectoryEntry | |
$domainConnection.AuthenticationType = [System.DirectoryServices.AuthenticationTypes]::Secure |
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
$chromeFolder = Join-Path $env:LOCALAPPDATA '\Google\Chrome' | |
$setupPath = Join-Path $chromeFolder '\Application\*.*\Installer\setup.exe' | |
# Use setup.exe from most recent version folder found. | |
if ((gci $setupPath).Count -gt 1) { | |
$setupPath = gci $setupPath | sort -Descending | |
$setupPath = $setupPath[0] | |
} | |
$argList = '--uninstall --multi-install --chrome --force-uninstall' |
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
Connect-MicrosoftTeams | |
$teams = Get-Team | |
foreach ($team in $teams) { | |
$teamApps = Get-TeamsAppInstallation -TeamId $team.GroupId | |
foreach ($app in $teamApps) { | |
Write-Output ('{0},{1},{2}' -f $team.DisplayName, $app.DisplayName, $app.TeamsAppId) >> c:\temp\TeamApps.csv | |
} | |
} |
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
$users = Get-ADUser -Server $DomainController -Filter * -Properties Name, DirectReports | |
foreach ($user in $users) { | |
$name = $user.Name | |
foreach ($report in $user.DirectReports) { | |
write-output (("$name, $report").Replace("CN=","") -replace ",OU=.*", "") >> c:\temp\ReportsByUser.csv | |
} | |
} |
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
Install-Module -Name AWS.Tools.Installer | |
Install-AWSToolsModule AWS.Tools.S3 -CleanUp | |
$bucket = 'some-s3-bucket' | |
Set-AWSCredential ` | |
-AccessKey '<Get Your Own>' ` | |
-SecretKey '<Get Your Own>' | |
# Gather files to upload |
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 GetPickListChoice { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string[]]$PickList, | |
[string]$Prompt = 'Type to search, Tab to cycle matches, Backspace to reset, ''?'' for a list: ', | |
[switch]$PromptNoNewLine | |
) | |
function ClearCurrentChoice { | |
for ($i = $origCursorPos.X; $i -lt $endPos; $i++) { |
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
$endTime = Get-Date "4:45PM" | |
Do { | |
$timeNow = Get-Date | |
if ($timeNow -ge $endTime) { | |
Write-Host "Ding! It's $endTime, time to work..." | |
# Do Stuff | |
Break | |
} else { | |
cls | |
Write-Host "Waiting until $endTime (Currently: $timeNow)" |
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
<# | |
- May 22, 2018 - V1.0 - DPO | |
+ Initial release. | |
- May 23, 2018 - V1.1 - DPO | |
+ Added check for packages/modules before force-installing them. | |
+ Added some output text. | |
+ Added 'ListOnly' switch, which will cause it to only display approved updates (not download or install them). | |
- May 23, 2018 - V1.2 - DPO | |
+ Added 'MicrosoftUpdate' switch to force the check to go to Microsoft Update (circumventing WSUS/WSUS approvals). | |
- v1.4 - DPO - July, 2021 |
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 Test-PasswordForDomain { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$Password, | |
[Parameter(Mandatory=$false)] | |
[string]$AccountSamAccountName = "", | |
[Parameter(Mandatory=$false)] | |
[string]$AccountDisplayName, | |
[Microsoft.ActiveDirectory.Management.ADEntity]$PasswordPolicy = (Get-ADDefaultDomainPasswordPolicy -ErrorAction SilentlyContinue) | |
) |