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 active Computers in Forest

$ForestInfo=Get-ADForest $Domains =$forestInfo.domains $FileName =$ForestInfo.RootDomain+”-Windows_Servers_60-9_Days_Active-“+”$(get-date -Format MM-dd-yyyy)”+”.csv” $FilePath = “c:\temp” $Daysactive = 60 $lastactive=(get-date).AddDays(-($Daysactive)) foreach($domain in $domains){ Write-Output “Working on $domain” Get-ADComputer -Filter {OperatingSystem -like...

Testing open ports With PowerShell

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 permissions

#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 =...

Get DC replication time response

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 ISO image using PowerShell

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 AD user Properties across the forest

#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...

Get DNS forwarder from forest

#Domain names in forest $ForestInfo = Get-ADForest$Domains =$forestInfo.domains$FileName = “DNSForwarder”+”$(get-date -Format MM-dd-yyyy)”+”.csv”$FilePath = “c:\temp”foreach($domain in $domains){Write-Output “Working on $domain”get-dnsserverforwarder -computer $domain| select IPAddress, @{l=”Domain”;e={$domain}}| Export-Csv...

UPDATE DNS IP in List of computers

#Input file is CSV file with headers IPaddress $Computers = import-csv “c:\temp\servers.csv” ForEach ($Computer in $Computers) {Write-Host “$($Computer.IPAddress): ” -ForegroundColor YellowInvoke-Command -ComputerName $Computer.IPAddress -ScriptBlock {...

Create Domain User and remove domain user

#Created domain user and add user account to domain group $domains = (get-adforest).domainsforeach($domain in $domains){$accountname = ‘s-user-‘+($domain -split “.”)[0]+’-DA’$accountpass = ‘P@ssword123456’ | ConvertTo-SecureString -Force -AsPlainTextWrite-Output...

Get IP address and DNS of remote computers

$Computers = GC “c:\temp\servers.txt” foreach($computer in $computers){Get-WMIObject Win32_NetworkAdapterConfiguration -Computername $Computer | Where-Object {$_.IPEnabled -match "True"} |Select-Object -property DNSHostName,@{N=”DNSServerSearchOrder”;E={“$($_.DNSServerSearchOrder)”}},@{N=’IPAddress’;E={$_.IPAddress}}|export-csv c:\temp\DNSlist.csv -NoTypeInformation -append#@{N=’DefaultIPGateway’;E={$_.DefaultIPGateway}}}

Power Off listed VM’s

Connect to  Vcenter Connect-VIServer  vmwareenterprise.com -WarningAction 0 ####### Shutdown all VMs from the list “C:\temp\vm.txt“########### foreach($vmlist in (Get-Content -Path C:\TEMP\vm.txt)) { $vm = Get-VM -Name...

Backup GPOs basing on GPO DisplayName

$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...

Activate Windows with KMS server

Activate Windows with KMS Server Step 1: KMS Client Setup Key Before activating your Microsoft product (Windows or Office) on the KMS server, you must change...

Get users Group and members of the groups

$AllUSers = get-aduser -filter {SamAccountName -like “z*” -and Enabled -eq $true } -Properties Memberof,EmployeeNumber -Server <Domain name> | ?{$PSItem.DistinguishedName -notmatch “OU=Service Accounts”} $results = new-object...
Categorie 1
Share folder permissions
#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 =...
Citrix Ports
ICA#1494 RDP#3389 CGP#2598 IMA#2512 AMC#2513 XML#8080 License Manager Daemon#27000 Citrix Vendor Daemon#7279 License Management Console#8082 Citrix Receiver#80 Citrix Receiver#443 Offline Plug-in-SMB#445 Power & Capacity Management...
Communication flow Citrix XenApp/XenDesktop logon process
Communication flow during the different stages of the Citrix XenApp/XenDesktop logon process 1. The user device submits credentials to the Web Interface (WI) or StoreFront (SF)...
XenApp & XenDesktop Avoid Customer Experience Improvement Program (CEIP)
when I updated to 7.14 I had the issue, because my license server and my delivery controller cannot communicate outside there is also a ugly...
Categories 2
Share folder permissions
#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 =...
Citrix Ports
ICA#1494 RDP#3389 CGP#2598 IMA#2512 AMC#2513 XML#8080 License Manager Daemon#27000 Citrix Vendor Daemon#7279 License Management Console#8082 Citrix Receiver#80 Citrix Receiver#443 Offline Plug-in-SMB#445 Power & Capacity Management...
Communication flow Citrix XenApp/XenDesktop logon process
Communication flow during the different stages of the Citrix XenApp/XenDesktop logon process 1. The user device submits credentials to the Web Interface (WI) or StoreFront (SF)...
XenApp & XenDesktop Avoid Customer Experience Improvement Program (CEIP)
when I updated to 7.14 I had the issue, because my license server and my delivery controller cannot communicate outside there is also a ugly...