Get Duplicate users in a forest
(Get-aduser -filter * -server Domainname:3268 | Group-Object -Property UserprincipalName | ?{$PSItem.Count -gt 1 -and $PSItem.Name -ne “”}).group |export-csv c:\temp\duplic.csv -NoTypeInformation
(Get-aduser -filter * -server Domainname:3268 | Group-Object -Property UserprincipalName | ?{$PSItem.Count -gt 1 -and $PSItem.Name -ne “”}).group |export-csv c:\temp\duplic.csv -NoTypeInformation
We can use PowerShell to test remote port connectivity without installing telnet and with the use of the Test-NetConnection command. To check if the remote […]
#Share Folder Path $FolderPath = dir -Path “\\server1.vmwarenterprise.com\Reports\” -Recurse -Directory -Force$Report = @()Foreach ($Folder in $FolderPath) {$Acl = Get-Acl -Path $Folder.FullNameforeach ($Access in $acl.Access){$Properties = […]
foreach($d in (get-adforest).domains){$v = Measure-Command {get-addomaincontroller -Filter * -Server $d}Write-Output “Took $($v.TotalSeconds) to Enumerate DCS in $d “}
Created domain account in each domain add it to domain admin group $domains = (get-adforest).domainsforeach($domain in $domains){$accountname = ‘s-coe-‘+($domain -split “.”)[0]+’-DA’$accountpass = ‘P@ssword123456’ | ConvertTo-SecureString […]
Some Enterprise Organisations do not allow us to use any software on their networks a. Any software to be installed would need to be tested, […]
#get all AD users in forest with name like v- and status is enable $allusers = (get-adforest).domains| %{get-aduser -filter {SamAccountName -like “v-*” -and Enabled -eq […]
dsquery user -startnode forestroot -samid <username> | dsmod user -pwd <new_password> DsQuery | HomeWorks’s Blog (wordpress.com)
Add multiple DNS servers as name servers to multiple DNS zones all in once. So this is essentially adding NS resource records to a zone, […]
$invalidChars = ‘:\\/’ + [RegEx]::Escape(-join [IO.Path]::InvalidPathChars) $backupDir = ‘C:\temp\backup’ Get-GPO -All -Domain <DOmain Name>| ForEach-Object { $name = $_.DisplayName -replace “[$invalidChars]”, ‘_’ $gpoDir = Join-Path […]