Category: PowerShell

PS: AD User Membership Comparison Script

PS: AD User Membership Comparison Script

The below script will prompt you to input two users and it will return a group membership comparison in the terminal with a slide indicator

[CmdletBinding()] 
Param ( 
    [Parameter(Mandatory=$true,ValueFromPipeline=$True)] 
    [string]$User1, 
    [Parameter(Mandatory=$true,ValueFromPipeline=$True)] 
    [string]$User2 
) 
 
Try {  
    Import-Module ActiveDirectory -ErrorAction Stop  
} Catch {  
    Write-Host "Unable to load Active Directory module, is RSAT installed?" -ForegroundColor Red; Exit  
} 
 
Try {  
    Get-ADUser $User1 -ErrorAction Stop -Properties MemberOf  
} Catch {  
    Write-Warning "Unable to locate [ $User1 ] in Active Directory"; Exit 
} 
 
Try {  
    Get-ADUser $User2 -ErrorAction Stop -Properties MemberOf  
} Catch {  
    Write-Warning "Unable to locate [ $User2 ] in Active Directory"; Exit 
} 
 
$MemberOf1 = get-aduser $User1 -Properties MemberOf | Select -ExpandProperty MemberOf 
$MemberOf2 = get-aduser $User2 -Properties MemberOf | Select -ExpandProperty MemberOf 
 
$Compare = Compare-Object $MemberOf1 $MemberOf2 -includeequal 
 
$Compare | foreach { 
    $_.InputObject = $_.InputObject.Substring(0, $_.InputObject.IndexOf(",")) 
    if ($_.SideIndicator -eq '') 
        {$_.SideIndicator = $User2} 
} 
 
$Compare
Advertisements
PS: Reset Surface Dock Registry

PS: Reset Surface Dock Registry

I found on the odd occasion my Surface Pro 4 dock gets into a bit of a unknown state and I am unable to extend my monitors if you find the same problem try running the following the script

Remove-Item "HKLM:SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration" -Recurse -Confirm:$false
Remove-Item "HKLM:SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Connectivity" -Recurse -Confirm:$false
Restart-Computer
PS: Set Office 365 Room Booking Permissions and delegates

PS: Set Office 365 Room Booking Permissions and delegates

####################################################################
# Room Calendar Booking Config Script By Daisy Stevens
# This script will set the users who have permission to 
#book the room, Configure approving deligates and set Auto Response
####################################################################
# Permitted users who can book against room
$UserList = @(
"User@Example.com","User@Example.com"
)
# Deligates to approve booking requests
$Deligates = @(
"deligate@example.com","deligate@example.com"
)
# Calendar Processing Properties
$CalProcProp = @{
    AutomateProcessing = 'AutoAccept'
    AllBookInPolicy       = $false
    AllRequestInPolicy    = $false
    AllRequestOutOfPolicy = $false
    ResourceDelegates  = $Deligates
    BookInPolicy       = $UserList
    RequestInPolicy    = $null
    RequestOutOfPolicy = $null
    AddAdditionalResponse = $true
    ProcessExternalMeetingMessages = $true
    AdditionalResponse = "This meeting room is a restricted resource. Please wait for acceptance confirmation of your booking"
}
## Set the Calendar Processing Properties
Set-CalendarProcessing "Room Name" @CalProcProp
PS: Enable Smart Screen

PS: Enable Smart Screen


################################################################################
# Enable Smart Screen Powershell Script By Daisy Stevens
# https://adminscriptbank.wordpress.com/
################################################################################
# Configuration Parameters
$SysParams = @{
    Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer'
    Name = 'SmartScreenEnabled'
    Value = 'Prompt'
    Force = $true
}
$EdgeParams = @{
    Path = 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter'
    Name = 'EnabledV9'
    Value = 'dword:00000001'
    Force = $true
}
$StoreParams = @{
    Path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost'
    Name = 'EnableWebContentEvaluation'
    Value = 'dword:00000002'
    Force = $true
}

# Add Configuration Function
function Set-SmartScreen {
    New-ItemProperty @SysParams
    New-ItemProperty @EdgeParams
    New-ItemProperty @StoreParams
}

# Function Calls
Set-SmartScreen