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
# Works when connecting to AD from Ubuntu 22.04. May have a dependency on OpenLDAP (libldap-commnad, libldap)? | |
function Connect-Ldap { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string]$ComputerName, | |
[switch]$UseTLS, | |
[int]$Port, | |
[Parameter(Mandatory = $true)] |
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-RTADObject { | |
[CmdletBinding()] | |
param( | |
[string]$LdapFilter, | |
[string]$ComputerName, | |
[PSCredential]$Credential | |
) | |
process { | |
if ($ComputerName) { |
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
# During a migration from Exchange 2010 to Exchange 2016, I needed to transition from Managed Folder Mailbox Policies | |
# to Retention Policies. In an effort to avoid disrupting existing user work flows, I needed to apply a tag to the | |
# Managed Folders folder separate from the DPT. I adapted this script from a blog post by Akash Bhargava (thanks!): | |
# https://docs.microsoft.com/en-us/archive/blogs/akashb/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershellexchange-2010 | |
# I'm not sure how well this will work for nested folders. | |
function Add-RetentionTagToFolder { | |
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='High')] | |
param( | |
[Parameter( | |
Mandatory=$true, |
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-IisLogFieldConfig { | |
[CmdletBinding()] | |
param( | |
[string[]$ComputerName, | |
) | |
PROCESS { | |
foreach ($computer in $ComputerName) { | |
Invoke-Command -ComputerName $computer -ScriptBlock { | |
[System.Reflection.Assembly]::LoadFrom( "C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" ) | Out-Null |
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 GetMoveParameters { | |
[CmdletBinding()] | |
param( | |
[string[]]$Mailbox, | |
[string[]]$Databases | |
) | |
PROCESS { | |
if ($Databases) { | |
$dbs = $Databases | Where-Object {$_.Mounted -eq $true} |
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
# Convert UserAccountControl attribute values to $true (enabled) or $false (disable). See https://support.microsoft.com/en-us/help/305144/how-to-use-useraccountcontrol-to-manipulate-user-account-properties | |
function ConvertTo-ADUserEnabled { | |
[CmdletBinding()] | |
param( | |
[int]$UserAccountControl | |
) | |
PROCESS { | |
switch ($UserAccountControl) { | |
512 {$true} |
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-MailboxItemTotal { | |
[CmdletBinding()] | |
param( | |
$Identity | |
) | |
PROCESS { | |
if ($Identity) { | |
Write-Verbose 'Getting specified mailboxes.' | |
$Identities = $Identity | Foreach-Object {Get-Mailbox -Identity $_} | Select-Object -ExpandProperty Identity |
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
# Assume file names are like ThatShow - S01E03 | |
# Assume they will go in their respective subfoders in a directory called Media (M:\Media) | |
$ParentPath = 'M:\Media' | |
# Get collection of .mp4 files from working directory | |
$files = Get-ChildItem *.mp4 | |
foreach ($file in $files) { | |
# Parse the title from the file name | |
$ShowTitle = $file.Name.Split('-')[0].TrimEnd() | |
# Parse the season from the file name | |
$Season = "Season " + [decimal]$file.Name.Split('-')[1].TrimStart().Substring(1,2) |
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 Search-ExchangeLogAndMailbox { | |
# TODO: Write help | |
[CmdletBinding(DefaultParameterSetName='Trace')] | |
param( | |
[Parameter(ValueFromPipelineByPropertyName=$true)] | |
[string]$Sender, | |
[Parameter(ValueFromPipelineByPropertyName=$true)] | |
[string]$MessageSubject, |
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
all: | |
children: | |
web: | |
hosts: | |
192.168.56.3: | |
vars: | |
# These credentials are being "rejected by the server"; Can do interactive login with same credentials | |
ansible_user: vagrant | |
ansible_password: vagrant | |
ansible_port: 5985 |
NewerOlder