Posts

Showing posts with the label Active Directory

Install Admin Pack on Remote Computer

Image
  Install-AdminPack Enable Admin Pack on Remote Computer with PowerShell By Michael J. Thomas There are many ways to get the job done but here is a solution to installing admin pack on a remote computer.  You may have other members of your IT team that need to have this installed on their computer but you don't want to get up and go to their computer. That is the magic of PowerShell Remote Administration.    $ComputerName = "RemoteComputer" Enter-PSSession -ComputerName $ComputerName #If there is a Group Policy blocking Windows Update then do this: Set-ItemProperty -Name "UseWUServer" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Value "0x00000000" -Type Dword  Restart-Service wuauserv Start-Sleep 2 #Register a Job to run this task for Installing Active Directory Tools $Name='Capability' Register-ScheduledJob -Name $name -ScriptBlock {Add-WindowsCapability -Online -Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~...

Set-ADPhoto

Image
Set-ADPhoto Set Active Directory Photo for Users By Michael J. Thomas I have been very busy lately, so I'm going to keep this one simple. How to set a photo for active directory user with PowerShell. The more built out version will be posted at a later time. function Set-ADPhoto { [ CmdletBinding ()] param( [ string ] $UserName , [ string ] $File ) $Photo =[ System.IO.File ]::ReadAllBytes( $File ) Set-ADUser $UserName -Replace @{thumbnailphoto= $Photo } }

Get-ADUserBasicInfo

Image
Formatting Basic AD Information in the Output your Want Get-ADUserBasicInfo Function by Michael J. Thomas Here is an example of how you an put together a basic list of information that you want to find out about a user's account. <# .Synopsis    Get-ADUserBasicInfo .DESCRIPTION    Gets the basic information of the user. Including UserName, First Name, Last Name, Email Address,    O365,Exchange DB, Title, Enabled, LockedOut, LastLogonDate, User OU, Notes .EXAMPLE    Get-ADUserBasicInfo -UserName "PowerShellGuy" .EXAMPLE     Get-ADUserBasicInfo -UserName "PowerShellGuy","michael.thomas" #> function Get-ADUserBasicInfo{  [cmdletbinding()]  Param(  [string[]]$UserName   )   #$ErrorActionPreference= 'silentlycontinue'  Foreach ($User in $Username){  $O365 = If ((Get-AdUser $User -Properties targetAddress).targetAddress -ne $null) { If ((Get-ADUser $User -...

Unlock All AD Accounts

Image
Has your service desk blown up with tons of calls because a lot of end users locked themselves out all at once unintentionally? Unfortunately, this does happen at some companies more often than others due to their login policies. You can easily get most of them back to work, I say most because there are those who actually forgot their passwords and don't know how to get to the self service portal for resetting their password themselves and will call you instead. Be the hero of the day for your fellow administrators and take those easy calls away from the Service Desk with the  following PowerShell script:  Search-ADAccount Search-ADAccount -LockedOut | Unlock-ADAccount