Skip to content

Instantly share code, notes, and snippets.

View kevinblumenfeld's full-sized avatar
🎯
Focusing

Kevin Blumenfeld kevinblumenfeld

🎯
Focusing
View GitHub Profile
ForEach ($User in $Users) {
$hash = @{
Name = $User.SamAccountName
Title = $User.Title
DisplayName = $User.DisplayName
GivenName = $User.GivenName
Surname = $User.Surname
Office = $User.Office
Department = $User.Department
Division = $User.Division
<#
.SYNOPSIS
Export key attributes for any ADGroup that has data in the proxyaddresses attribute.
Does not contain member export/import yet.
.EXAMPLE
.\Get-ADGroupDetailed.ps1 | Export-Csv .\ADGroupDetailed.csv -notypeinformation -Encoding UTF8
#>
$properties = @('Description', 'DisplayName', 'dLMemSubmitPerms', 'dLMemSubmitPermsBL'
# Set the dynamic parameters' name
$ParamName_emaildomain = 'EmailDomain'
# Create the collection of attributes
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
# Create and set the parameters' attributes
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.Position = 1
# Add the attributes to the attributes collection
<#
.EXTERNALHELP PSCloudConnect-help.xml
#>
function Get-LAConnected {
[CmdletBinding(SupportsShouldProcess = $true)]
Param
(
DynamicParam {
# Set the dynamic parameters' name
$ParamName_emaildomain = 'EmailDomain'
# Create the collection of attributes
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
# Create and set the parameters' attributes
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.Mandatory = $true
DynamicParam {
# Set the dynamic parameters' name
$ParamName_emaildomain = 'EmailDomain'
# Create the collection of attributes
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
# Create and set the parameters' attributes
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.Mandatory = $true
Function Copy-ADUser {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)]
$Template,
[Parameter(Mandatory = $True)]
$FirstName,
[Parameter(Mandatory = $True)]
$LastName,
[Parameter(Mandatory = $False)]
function Get-SAM ($LastName,$FirstName)
{
if (!$Prefix) {
$SamAccountName = (($LastName[0..6] -join '') + $FirstName)[0..7] -join ''
$SamAccountName
$i = 2
#while ((get-aduser -LDAPfilter "(samaccountname=$samaccountname)"))
while ($SamAccountName -match "RodriguJ|RodrigJ\d|SmithSa.|WoMe\d$|WoMe$")
{
Function Sync-ADConnect {
Param (
[Parameter(Mandatory = $False)]
[switch] $Initial,
[Parameter(Mandatory = $False)]
$Sleep = 60
)
<#
.SYNOPSIS
Forces Sync of Azure AD Connect (Synchronizes on premises Active Directory with Azure AD/Office 366)
Function New-UserToCloud {
<#
users.csv
UserToCopy,FirstName,LastName,P
itpizzas,Joe,Hammer,FakePass
#>
[CmdletBinding()]
Param (
[parameter(ValueFromPipelineByPropertyName)]