Home
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1034
Get-ADGroupMember $group | Move-ADObject -targetpath "OU=IT,OU=Users,DC=tcsbank,DC=ru"
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1088
#Import-Module ActiveDirectory
#add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
. 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
Connect-ExchangeServer -auto
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1062
Add-Type -AssemblyName System.Speech
$synthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
$synthesizer.Speak('Hey, I can speak!')
- Details
- Written by: Senka
- Category: Exchange Server
- Hits: 1137
# export photo
$a= Get-ADUser USERNAME -Properties thumbnailphoto
$a.thumbnailphoto | Set-Content c:\path\photo.jpg -Encoding byte
# have photo
$date = (Get-Date).AddDays(-90)
Get-ADUser -Filter {lastlogontimestamp -gt $date -and EmailAddress -like '*' -and thumbnailphoto -notlike '*'} -property * | Select Name,SamAccountName,EmailAddress,Department,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}| ?{$_.Disabled -eq 0} | Sort-Object name | export-csv nophoto.csv -Delimiter ";" -NoTypeInformation -Encoding Default
Get-ADUser -Filter {lastlogontimestamp -gt $date -and EmailAddress -like '*' -and thumbnailphoto -like '*'} -property * | Select Name,SamAccountName,EmailAddress,Department,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}| ?{$_.Disabled -eq 0} | Sort-Object name | export-csv photo.csv -Delimiter ";" -NoTypeInformation -Encoding Default
# import photo
param ($name)
$login="$name@domen"
Import-RecipientDataProperty -Identity $login -Picture -FileData ([Byte[]]$(Get-Content -Path "f:\tasks\exchange_photo\photo\$name.jpg" -Encoding Byte -ReadCount 0))
To remove a photo use the following:
Set-Mailbox USERNAME -removepicture