![Setting up Single Sign-On (SSO) between G Suite and Office 365 with G Suite as identity provider (IdP)](https://princepy.com/wp-content/uploads/2019/11/Screen-Shot-2019-11-25-at-11.09.47-PM-1024x747.png)
Tutorial: Azure Active Directory single sign-on (SSO) integration with G Suite
PowerShell Code Snippet
Strip-Word
Function Strip-Word {
Param (
[Parameter(mandatory=$true,Position=1)][string]$word,
[Parameter(mandatory=$true,Position=2)][int]$length,
[Parameter(mandatory=$false,Position=3)][AllowNull()][switch]$encode
)
$word = $word -replace '[^a-zA-Z0-9-\(\)_ ]', ''
if($encode) {
return [System.Web.HttpUtility]::UrlEncode($word.PadRight($length,' ').Substring(0,$length).Trim());
} else {
return $word.PadRight($length,' ').Substring(0,$length).Trim();
}
}
Test-ADCredential
# Test-ADCredential.ps1
CLS
<#
.Synopsis
Verify Active Directory credentials
.DESCRIPTION
This function takes a user name and a password as input and will verify if the combination is correct. The function returns a boolean based on the result.
.NOTES
Name: Test-ADCredential
Author: Jaap Brasser
Version: 1.0
DateUpdated: 2013-05-10
.PARAMETER UserName
The samaccountname of the Active Directory user account
.PARAMETER Password
The password of the Active Directory user account
.EXAMPLE
Test-ADCredential -username jaapbrasser -password Secret01
Description:
Verifies if the username and password provided are correct, returning either true or false based on the result
#>
function Test-ADCredential {
[CmdletBinding()]
Param
(
[string]$UserName,
[string]$Password
)
if (!($UserName) -or !($Password)) {
Write-Warning 'Test-ADCredential: Please specify both user name and password'
} else {
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain')
$DS.ValidateCredentials($UserName, $Password)
}
}
try{ $testADCredential = $null; $testADCredential = Get-Credential } catch { $testADCredential = $null; }
if($testADCredential -ne $null) { Test-ADCredential -UserName "$($testADCredential.UserName)" -Password "$($testADCredential.GetNetworkCredential().password)"; }
pause; return;
Active Directory account locking out after password reset
Several end-users account locking out after recently resetting their domain password.
Our domain policy is lockout Threshold 3 attempts. They are getting locked out after 1 try. Once the user logs in, any network or domain resources they try to get to prompt them for their credentials because they are locked out. Their domain account shows locked in AD as well.
Continue reading “Active Directory account locking out after password reset”Deploy a .NET Core API with Docker
SplitCSV – Split comma-separated column as Table
How to split/denormalize a SQL table where one of the columns contains comma-separated values
Continue reading “SplitCSV – Split comma-separated column as Table”Updating the Windows Console Colors
$Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'Black')
$Host.UI.RawUI.ForegroundColor = 'White'
$Host.PrivateData.ErrorForegroundColor = 'Red'
$Host.PrivateData.ErrorBackgroundColor = $bckgrnd
$Host.PrivateData.WarningForegroundColor = 'Magenta'
$Host.PrivateData.WarningBackgroundColor = $bckgrnd
$Host.PrivateData.DebugForegroundColor = 'Yellow'
$Host.PrivateData.DebugBackgroundColor = $bckgrnd
$Host.PrivateData.VerboseForegroundColor = 'Green'
$Host.PrivateData.VerboseBackgroundColor = $bckgrnd
$Host.PrivateData.ProgressForegroundColor = 'Yellow'
$Host.PrivateData.ProgressBackgroundColor = $bckgrnd
$Host.PrivateData.ConsolePaneForegroundColor = 'DarkCyan'
$Host.PrivateData.ConsolePaneBackgroundColor= $bckgrnd
$Host.PrivateData.ConsolePaneTextBackgroundColor= 'Yellow'
Set-PSReadlineOption -ResetTokenColors
Clear-Host
React Higher-Order Components
function withHover(Component, propName = 'hovering') {
return class WithHover extends React.Component {
state = { hovering: false }
mouseOver = () => this.setState({ hovering: true })
mouseOut = () => this.setState({ hovering: false })
render() {
console.log(this.props) // { height: "16px" }
const props = {
[propName]: this.state.hovering,
...this.props,
}
return (
<div onMouseOver={this.mouseOver} onMouseOut={this.mouseOut}>
<Component {...props} />
</div>
);
}
}
}
Introduction to higher-order components (HOC) in React
React Higher-Order Components in 3 minutes
dbatools: Migrate SQL Server Logins Between Instances
Uses PowerShell and SMO to migrate SQL logins. Logins are completely migrated and maintain their SIDs, passwords, server/database roles, server/database permission sets & securable, default database and login attributes. Works on SQL Server 2000 and above.