I review for BookLook Bloggers
Showing posts with label Active Directory. Show all posts
Showing posts with label Active Directory. Show all posts

Wednesday, August 22, 2018

Fix AD-USERS Naming Convention [1st letter Uppercase and rest Lower]

Description
Description: This Script Does the following things.
1> Rename Active Directory User's Firstname, Lastname 1st letter to Uppercase ex: JOhn SnOw or john snOn or JOHN SNOW becomes -, John Snow
2> Rename Active Directory User's samaccountname to all lower case example: Jonh becomes - john
3> Rename Active Directory User's Displayname and NAme 1st letter to Uppercase ex: JOhn SnOw or john snOn or JOHN SNOW becomes -John Snow

Source Code

** Recommend to perform in the test environment before moving to the production environment.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<#===========================================================================================================================
Script Name: FixADNAmes.ps1
Description: This Script Does the following things.
            1> Rename Active Directory User's  Firstname,Lastname 1st letter to Uppercase ex: JOhn SnOw or john snOn or JOHN SNOW becomes -John Snow
            2> Rename Active Directory User's samaccountname to all lower case example: Jonh becomes - john
            3> Rename Active Directory User's  Displayname and NAme 1st letter to Uppercase ex: JOhn SnOw or john snOn or JOHN SNOW becomes -John Snow

           
      Inputs: OU path if Required to run on an OU
      Outputs: 

Notes: Run as administrator
Date Created: 08/21/2018
      Credits: 
Last Revised: 08/21/2018


** Instructions**
Just Launch Powershell as administrator copy the script and run or save and run it as
FixADNAmes.ps1
=============================================================================================================================#> 
If ( ! (Get-module ActiveDirectory )) {
  Import-Module ActiveDirectory
  Clear-Host
  }

Get-ADUser -filter *  <#-SearchBase 'OU=OU,DC=domain,DC=Local'#>|Foreach{
$newFname=(Get-Culture).textinfo.totitlecase(($_.givenname).tolower())
$newLname=(Get-Culture).textinfo.totitlecase(($_.Surname).tolower())
$name= $newFname + ' ' + $newLname
Set-ADUser $_ -GivenName $newFname -Surname $newLname
Rename-ADObject -Id $_ -NewName $name
Set-ADUser $_.samaccountname -DisplayName $name
Set-ADUser $_.samaccountname -SamAccountName $_.SamAccountName.ToLower()
}



Clear-Host
Write-Host 'The process has been completed' -ForegroundColor Yellow
"Here is how AD users Looks now"
$newU=(Get-ADUser -filter * <#-SearchBase $ou #> -prop Displayname |Get-Random |select -First 1)
$newU |select Name,Displayname,Givenname,surname,samaccountname

Screenshots

Tuesday, May 5, 2015

Active Directory Quick Deployment scripts in Windows 2012 R2 – New/Add

Had to build domain controllers often for production and testing. These are my handy scripts which i use to add domain controllers or build fresh environments in production, and to quickly build labs for testing purposes.

Hope it will be useful for everyone.  Will be covering building new domain controller and adding a domain controller.
Lets see how to build a new Domain Controller and add a additional domain controller – with the Quick Script
Download the Scripts
Step1:
Login to the first machine to build a first domain controller in the environment.
Open PowerShell – Run
.\new-domainccontroller.ps1
NOTE : Open the Script and add your domain name and NETBIOS Name,
Good to know : Script will be building a domain with 2012R2 forest/domain functional level.
image
Step2:
Enter Safemodeadministratorpassword
and confirm it.
image
image
After Rebooting automatically – Domain Controller is READY !!
Start – Run – dsa.msc – Just to see AD tools
image
====
Step3:
To Add Domain Controller
Login to the new local machine – Add the machine to the domain. (Hope you already entered Primary DNS IP in the LAN)
$cred = Get-Credential
image

$creds = Get-credential
Add-Computer -DomainName testexchange.biz –credential $Creds –Restart
Machine will add to the domain after reboot.
Step4:
Run –
.\Add-DomainController.ps1
NOTE : Open the Script and add your domain name.
image
After Reboot – Secondary Domain Controller is added.
image
Download the Scripts

Original:

Thursday, February 26, 2015

List of Port numbers in Windows

List of Port numbers in Windows

Below is the list of TCP/UDP  port numbers being used in windows

Port
TCP
UDP
Description
9
UDP
Wake-on-LAN
20
TCP
UDP
FTP data transfer
21
TCP
FTP control (command)
22
TCP
UDP
Secure Shell (SSH) — used for secure logins, 
file transfers (scp, sftp) and port forwarding
23
TCP
UDP
Telnet protocol—unencrypted text communications
25
TCP
Simple Mail Transfer Protocol (SMTP)
used for e-mail routing between mail servers
42
TCP
UDP
Windows Internet Name Service
53
TCP
UDP
Domain Name System (DNS)
57
TCP
Mail Transfer Protocol (RFC 780)
67
UDP
Bootstrap Protocol (BOOTP) Server; 
also used by Dynamic Host Configuration Protocol (DHCP)
68
UDP
Bootstrap Protocol (BOOTP) Client; 
also used by Dynamic Host Configuration Protocol (DHCP)
69
UDP
Trivial File Transfer Protocol (TFTP)
80
TCP
Hypertext Transfer Protocol (HTTP)
88
TCP
UDP
Kerberos—authentication system
115
TCP
Simple File Transfer Protocol (SFTP)
119
TCP
Network News Transfer Protocol (NNTP)
—retrieval of newsgroup messages
123
UDP
Network Time Protocol (NTP)—used for time synchronization
135
TCP
UDP
DCE endpoint resolution
135
TCP
UDP
Microsoft EPMAP (End Point Mapper), 
also known as DCE/RPC Locator service,[15] 
used to remotely manage services 
including DHCP server, DNS server and WINS.
137
TCP
UDP
NetBIOS NetBIOS Name Service
138
TCP
UDP
NetBIOS NetBIOS Datagram Service
139
TCP
UDP
NetBIOS NetBIOS Session Service
143
TCP
Internet Message Access Protocol (IMAP)—
management of email messages
161
UDP
Simple Network Management Protocol (SNMP)
162
TCP
UDP
Simple Network Management Protocol Trap (SNMPTRAP)[18]
389
TCP
UDP
Lightweight Directory Access Protocol (LDAP)
401
TCP
UDP
UPS Uninterruptible Power Supply
443
TCP
Hypertext Transfer Protocol over TLS/SSL (HTTPS)
445
TCP
Microsoft-DS Active Directory, Windows shares
445
TCP
Microsoft-DS SMB file sharing
464
TCP
UDP
Kerberos Change/Set password
530
TCP
UDP
RPC
543
TCP
klogin, Kerberos login
544
TCP
kshell, Kerberos Remote shell
546
TCP
UDP
DHCPv6 client
547
TCP
UDP
DHCPv6 server
636
TCP
UDP
Lightweight Directory Access Protocol over TLS/SSL (LDAPS)
647
TCP
DHCP Failover protocol[24]
989
TCP
UDP
FTPS Protocol (data): FTP over TLS/SSL
1812
TCP
UDP
radius, RADIUS authentication protocol
1813
TCP
UDP
radacct, RADIUS accounting protocol
3389
TCP
UDP
Microsoft Terminal Server (RDP)
6600
TCP
Microsoft Hyper-V Live
Original: