This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $objects = Get-ADUser -Filter * -SearchBase "OU=TURKEY-TR,OU=Accounts,DC=babur,DC=com" -Properties samaccountname, pwdLastSet | |
| foreach ($object in $objects) { | |
| if (($object.samaccountname -like '*ö*') -or ($object.samaccountname -like '*ı*') -or ($object.samaccountname -like '*ğ*') ) { | |
| Write-Host "Name contains '$'" | |
| $object.samaccountname | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $users = (Get-ADUser -Properties * -filter * -SearchBase "OU=Accounts,DC=babur,DC=hol" | select samaccountname).SamAccountName | |
| foreach ($username in $users) { | |
| $user = Get-ADUser -identity $username -properties pwdlastset | |
| #Before Changed | |
| [datetime]::FromFileTime($user.pwdlastset) | |
| $user.pwdlastset=0 | |
| set-aduser -Instance $user | |
| $user.pwdlastset = -1 | |
| set-aduser -Instance $user | |
| $user = Get-ADUser -identity $username -properties pwdlastset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $administrators = @( | |
| ([ADSI]"WinNT://./Administrators").psbase.Invoke('Members') | | |
| % { | |
| $_.GetType().InvokeMember('AdsPath','GetProperty',$null,$($_),$null) | |
| } | |
| ) -match '^WinNT'; | |
| $administrators = $administrators -replace "WinNT://","" | |
| foreach ($adm in $administrators) { | |
| if($adm -match 'S-1-5-21*') { | |
| Remove-LocalGroupMember -Group "Administrators" -Member $adm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $str="Name;Memberof" | |
| $str+= "`r`n" | |
| $list = get-aduser -filter * -SearchBase "OU=TR,DC=babur,DC=hol" | select samaccountname | |
| $list.samaccountname| ` | |
| %{ | |
| $user = $_; | |
| $grp=((get-aduser $user -Properties memberof | select memberof).memberof | Get-ADGroup|select Name|sort name).name | |
| foreach ($g in $grp) { | |
| $str+=$user+";"+$g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #arşiv özelliği kapalı olan kullanıcıları $users değişkenine atar | |
| $users=(Get-ExoMailbox -ResultSize Unlimited -PropertySets Archive | where {$_.ArchiveStatus -eq "None"}).UserPrincipalName | |
| $archiveenabled= "Mail Adresi" | |
| $archiveenabled += "`r`n" | |
| $count = 0 | |
| foreach($usr in $users) { | |
| #users içerisinde olan kullanıcıları tek tek mailbox boyutları çevrilir. | |
| $Stats = Get-EXOMailbox -UserPrincipalName $usr | Get-EXOMailboxStatistics | Select-Object *, @{Name="TotalItemSizeGB"; Expression={[math]::Round(($_.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1GB),0)}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $computers = (Get-ADComputer -SearchBase "OU=TURKEY-TR,OU=Accounts,DC=xxx,DC=xxx" -Properties * -filter *).name | |
| foreach ($comp in $computers) { | |
| Get-AdmPwdPassword -ComputerName $comp | where {$_.password -eq $null} | select computername, Distinguishedname | |
| } |