Wednesday, August 28, 2013

the trust relationship between this workstation and the primary domain failed. Windows 2008 EE

Just change your computer password using netdom.exe!

netdom.exe resetpwd /s: /ud: /pd:*

= a domain controller in the joined domain

= DOMAIN\User format with rights to change the computer password
Here are the full steps:
  1. You need to be able to get onto the machine. I normally just log in with the local Administrator account by typing, ".\Administrator" in the logon window. I hope you remember the password. If you’re creative and resourceful you can hack your way in without the password. Another option is to unplug the machine from the network and log in with domain user. You will be able to do disconnected authentication, but in the case of a reset machine, remember that you may have to use an old password. Your domain user’s cached credential has the same problem as the machine’s private secret.
  2. You need to make sure you have netdom.exe. Where you get netdom.exe depends on what version of Windows you’re running. Windows Server 2008 and Windows Server 2008 R2 ship with netdom.exe you just have to enable the Active Directory Domain Services role. On Windows Vista and Windows 7 you can get it from the Remote Server Administration Tools (RSAT). Google can help you get them. For other platforms see this link: http://technet.microsoft.com/en-us/library/ee649281(WS.10).aspx"
  3. Extra steps if the machine is a domain controller. If the broken machine is a domain controller it is a little bit more complicated, but still possible to fix the problem. I haven’t done this for a while, but I think this works:
    1. Turn off the Kerberos Key Distribution Center service. You can do this in the Services MMC snap-in. Set the startup type to Manual. Reboot.
    2. Remove the Kerberos ticket cache. A reboot will do this for you, or you can remove them using KerbTray.exe. You can get that tool here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17657
    3. Post change steps. Do these in conjunction with 5 below. Turn the Kerberos Key Distribution Center Service back on before rebooting. You should reboot the domain controller and then force replication in the Active Directory Sites and Services MMC snap-in.
  4. Run netdom.exe to change the password.
    1. Open an administrative command prompt. On Windows platforms with UAC enabled, you will need to right-click on cmd.exe and select "run as Administrator".
    2. Type the following command: netdom.exe resetpwd /s: /ud: /pd:*
  5. Reboot the machine.
Here is more information on netdom.exe: http://support.microsoft.com/kb/325850

Thursday, August 15, 2013

How can I determine who are the current FSMO Roles holders in my domain/forest?

Windows 2000/2003 Active Directory domains utilize a Single Operation Master method called FSMO (Flexible Single Master Operation), as described in Understanding FSMO Roles in Active Directory. 

The five FSMO roles are:

• Schema master - Forest-wide and one per forest. 

• Domain naming master - Forest-wide and one per forest. 

• RID master - Domain-specific and one for each domain. 

 PDC - PDC Emulator is domain-specific and one for each domain. 

 Infrastructure master - Domain-specific and one for each domain. 

In most cases an administrator can keep the FSMO role holders (all 5 of them) in the same spot (or actually, on the same DC) as has been configured by the Active Directory installation process. However, there are scenarios where an administrator would want to move one or more of the FSMO roles from the default holder DC to a different DC. The transferring method is described in the Transferring FSMO Roles article, while seizing the roles from a non-operational DC to a different DC is described in the Seizing FSMO Roles article. 

In order to better understand your AD infrastructure and to know the added value that each DC might possess, an AD administrator must have the exact knowledge of which one of the existing DCs is holding a FSMO role, and what role it holds. With that knowledge in hand, the administrator can make better arrangements in case of a scheduled shut-down of any given DC, and better prepare him or herself in case of a non-scheduled cease of operation from one of the DCs.

How to find out which DC is holding which FSMO role? Well, one can accomplish this task by many means. This article will list a few of the available methods.

Method #1: Know the default settings

The FSMO roles were assigned to one or more DCs during the DCPROMO process. The following table summarizes the FSMO default locations:

FSMO Role Number of DCs holding this role Original DC holding the FSMO role
Schema One per forest The first DC in the first domain in the forest (i.e. the Forest Root Domain)
Domain Naming One per forest 
RID One per domain The first DC in a domain (any domain, including the Forest Root Domain, any Tree Root Domain, or any Child Domain)
PDC Emulator One per domain 
Infrastructure One per domain 

Method #2: Use the GUI

The FSMO role holders can be easily found by use of some of the AD snap-ins. Use this table to see which tool can be used for what FSMO role:

FSMO Role Which snap-in should I use?
Schema Schema snap-in
Domain Naming AD Domains and Trusts snap-in
RID AD Users and Computers snap-in
PDC Emulator 
Infrastructure 

Finding the RID Master, PDC Emulator, and Infrastructure Masters via GUI

To find out who currently holds the Domain-Specific RID Master, PDC Emulator, and Infrastructure Master FSMO Roles:

1. Open the Active Directory Users and Computers snap-in from the Administrative Tools folder. 
2. Right-click the Active Directory Users and Computers icon again and press Operation Masters. 
3. Select the appropriate tab for the role you wish to view. 
4. When you're done click close. 

Finding the Domain Naming Master via GUI

To find out who currently holds the Domain Naming Master Role:
1. Open the Active Directory Domains and Trusts snap-in from the Administrative Tools folder. 
2. Right-click the Active Directory Domains and Trusts icon again and press Operation Masters. 
3. When you're done click close. 

Finding the Schema Master via GUI

To find out who currently holds the Schema Master Role:
1. Register the Schmmgmt.dll library by pressing Start > RUN and typing: 
2. Press OK. You should receive a success confirmation. 
3. From the Run command open an MMC Console by typing MMC. 
4. On the Console menu, press Add/Remove Snap-in. 
5. Press Add. Select Active Directory Schema. 
6. Press Add and press Close. Press OK. 
7. Click the Active Directory Schema icon. After it loads right-click it and press Operation Masters.
8. Press the Close button. 

Method #3: Use the Ntdsutil command

The FSMO role holders can be easily found by use of the Ntdsutil command.

Caution: Using the Ntdsutil utility incorrectly may result in partial or complete loss of Active Directory functionality.
1. On any domain controller, click Start, click Run, type Ntdsutil in the Open box, and then click OK. 
2. Type roles, and then press ENTER. 

Note: To see a list of available commands at any of the prompts in the Ntdsutil tool, type ?, and then press ENTER.
3. Type connections, and then press ENTER. 
4. Type connect to server , where is the name of the server you want to use, and then press ENTER.
5. At the server connections: prompt, type q, and then press ENTER again.
6. At the FSMO maintenance: prompt, type Select operation target, and then press ENTER again.

At the select operation target: prompt, type List roles for connected server, and then press ENTER again.

select operation target: List roles for connected server

Server "server100" knows about 5 roles

Schema - CN=NTDS Settings,CN=SERVER100,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=C

onfiguration,DC=dpetri,DC=net

Domain - CN=NTDS Settings,CN=SERVER100,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=C

onfiguration,DC=dpetri,DC=net

PDC - CN=NTDS Settings,CN=SERVER100,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Conf

iguration,DC=dpetri,DC=net

RID - CN=NTDS Settings,CN=SERVER100,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Conf

iguration,DC=dpetri,DC=net

Infrastructure - CN=NTDS Settings,CN=SERVER100,CN=Servers,CN=Default-First-Site-Name,CN=Si

tes,CN=Configuration,DC=dpetri,DC=net

select operation target:

8. Type q 3 times to exit the Ntdsutil prompt.

Note: You can download THIS nice batch file that will do all this for you (1kb).

Another Note: Microsoft has a nice tool called Dumpfsmos.cmd, found in the Windows 2000 Resource Kit (and can be downloaded here: Download Free Windows 2000 Resource Kit Tools). This tool is basically a one-click Ntdsutil script that performs the same operation described above.

Method #4: Use the Netdom command

The FSMO role holders can be easily found by use of the Netdom command.

Netdom.exe is a part of the Windows 2000/XP/2003 Support Tools. You must either download it separately (from here Download Free Windows 2000 Resource Kit Tools) or by obtaining the correct Support Tools pack for your operating system. The Support Tools pack can be found in the \Support\Tools folder on your installation CD (or you can Download Windows 2000 SP4 Support Tools, Download Windows XP SP1 Deploy Tools).

1. On any domain controller, click Start, click Run, type CMD in the Open box, and then click OK.
2. In the Command Prompt window, type netdom query /domain: fsmo (where is the name of YOUR domain).

Close the CMD window.

Note: You can download THIS nice batch file that will do all this for you (1kb).

Method #5: Use the Replmon tool

The FSMO role holders can be easily found by use of the Netdom command.

Just like Netdom, Replmon.exe is a part of the Windows 2000/XP/2003 Support Tools. Replmon can be used for a wide verity of tasks, mostly with those that are related with AD replication. But Replmon can also provide valuable information about the AD, about any DC, and also about other objects and settings, such as GPOs and FSMO roles. Install the package before attempting to use the tool.

1. On any domain controller, click Start, click Run, type REPLMON in the Open box, and then click OK.
2. Right-click Monitored servers and select Add Monitored Server.
3. In the Add Server to Monitor window, select the Search the Directory for the server to add. Make sure your AD domain name is listed in the drop-down list.
4. In the site list select your site, expand it, and click to select the server you want to query. Click Finish.
5. Right-click the server that is now listed in the left-pane, and select Properties.
6. Click on the FSMO Roles tab and read the results.
7. Click Ok when you're done. 

File Replication Service (FRS) Status Viewer

Sonar.exe is a graphical tool that allows administrators to monitor key statistics and status about members of a file replication service (FRS) replica set. Administrators can use Sonar to watch key statistics on a replica set in order to monitor traffic levels, backlogs, and free space.

You can download from Microsoft Site: http://www.microsoft.com/en-us/download/details.aspx?id=3745

How can we switch the roles in an Active Directory?

To Transfer the Schema Master Role:
  1. Register the Schmmgmt.dll library by pressing Start > RUN and typing:
regsvr32 schmmgmt.dll
  1. Press OK. You should receive a success confirmation.
  2. From the Run command open an MMC Console by typing MMC.
  3. On the Console menu, press Add/Remove Snap-in.
  4. Press Add. Select Active Directory Schema.
  5. Press Add and press Close. Press OK.
  6. If you are NOT logged onto the target domain controller, in the snap-in, right-click the Active Directory Schema icon in the Console Root and press Change Domain Controller.
  7. Press Specify .... and type the name of the new role holder. Press OK.
  8. Right-click right-click the Active Directory Schema icon again and press Operation Masters.
  9. Press the Change button.
  10. Press OK all the way out.
Transferring the FSMO Roles via Ntdsutil
To transfer the FSMO roles from the Ntdsutil command:
Caution: Using the Ntdsutil utility incorrectly may result in partial or complete loss of Active Directory functionality.
  1. On any domain controller, click Start, click Run, type Ntdsutil in the Open box, and then click OK.
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\WINDOWS>ntdsutil
ntdsutil:
  1. Type roles, and then press ENTER.
ntdsutil: roles
fsmo maintenance:
Note: To see a list of available commands at any of the prompts in the Ntdsutil tool, type ?, and then press ENTER.
  1. Type connections, and then press ENTER.
fsmo maintenance: connections
server connections:
  1. Type connect to server , where  is the name of the server you want to use, and then press ENTER.
server connections: connect to server server100
Binding to server100 ...
Connected to server100 using credentials of locally logged on user.
server connections:
  1. At the server connections: prompt, type q, and then press ENTER again.
server connections: q
fsmo maintenance:
  1. Type transfer . where  is the role you want to transfer.
For example, to transfer the RID Master role, you would type transfer rid master:
Options are:
Transfer domain naming master
Transfer infrastructure master
Transfer PDC
Transfer RID master
Transfer schema master
  1. You will receive a warning window asking if you want to perform the transfer. Click on Yes.
  2. After you transfer the roles, type q and press ENTER until you quit Ntdsutil.exe.
  3. Restart the server and make sure you update your backup.

Tuesday, August 13, 2013

Linux Troubleshoot Cheat Sheet

·         Dump a MySQL database to an SQL file:
mysqldump -l --opt databasename > filename.sql -u theusername --password=thepassword
·         Import a MySQL database dump:
mysql databasename < filename.sql  -u theusername --password=thepassword
·         Update a directory, recursively:
cp -ru /source/ /destination --reply=yes
·         Create a gzipped tar archive of a directory:
tar zcf directory.tar.gz directory/
·         Transfer a directory to another server:
tar zcf - directory/ | ssh 192.168.0.1 "cd /destination; tar zpxvf -"
·         Extract one file from a .tar.gz file:
gzip -dc file.tar.gz | tar xf - pathname/filename
The pathname and filename should be exactly as given in the .tar.gz file. If you want more than one file append their names, again including pathname, at the end of the command.
·         Create symbolic links:
ln -s /source /destination
·         Set file system permissions, owners, and group owners recursively:
chmod -R 0775 /directory
chown -R username:groupname /directory
·         Info about Linux distro and version
cat /proc/version
# alternatives:
cat /etc/*-release
cat /etc/*version
lsb_release -a     # for debian stable
alias    Create an alias
awk      Find and Replace text within file(s)
blkid    Displays the UUID of a mounted filesystem
break    Exit from a loop
builtin  Run a shell builtin
cal      Display a calendar
case     Conditionally perform a command
cat      Display the contents of a file
cd       Change Directory
chgrp    Change group ownership
chmod    Change access permissions
chown    Change file owner and group
chroot   Run a command with a different root directory
cksum    Print CRC checksum and byte counts
clear    Clear terminal screen
cmp      Compare two files
comm     Compare two sorted files line by line
command  Run a command - ignoring shell functions
continue Resume the next iteration of a loop
cp       Copy one or more files to another location
cron     Daemon to execute scheduled commands
crontab  Schedule a command to run at a later time
csplit   Split a file into context-determined pieces
cut      Divide a file into several parts
date     Display or change the date & time
dc       Desk Calculator
dd       Data Dump - Convert and copy a file
declare  Declare variables and give them attributes
df       Display free disk space
diff     Display the differences between two files
diff3    Show differences among three files
dir      Briefly list directory contents
dircolors Colour setup for `ls'
dirname  Convert a full pathname to just a path
dirs     Display list of remembered directories
dmidecode Dump DMI (SMBIOS) table (displays system information)
du       Estimate file space usage
echo     Display message on screen
ed       A line-oriented text editor (edlin)
egrep    Search file(s) for lines that match an extended expression
eject    Eject CD-ROM
enable   Enable and disable builtin shell commands
env      Display, set, or remove environment variables
eval     Evaluate several commands/arguments
exec     Execute a command
exit     Exit the shell
expand   Convert tabs to spaces
export   Set an environment variable
expr     Evaluate expressions
factor   Print prime factors
false    Do nothing, unsuccessfully
fdformat Low-level format a floppy disk
fdisk    Partition table manipulator for Linux
file     Determine file type (file -bi)
fgrep    Search file(s) for lines that match a fixed string
find     Search for files that meet a desired criteria
fmt      Reformat paragraph text
fold     Wrap text to fit a specified width.
for      Expand words, and execute commands
format   Format disks or tapes
free     Display memory usage
fsck     Filesystem consistency check and repair.
function Define Function Macros
gawk     Find and Replace text within file(s)
getopts  Parse positional parameters
grep     Search file(s) for lines that match a given pattern
groups   Print group names a user is in
gzip     Compress or decompress named file(s)
hash     Remember the full pathname of a name argument
head     Output the first part of file(s)history  Command History
hostname Print or set system name
id       Print user and group id's
if       Conditionally perform a command
import   Capture an X server screen and save the image to file
info     Help info
install  Copy files and set attributes
join     Join lines on a common field
kill     Stop a process from running
less     Display output one screen at a time
let      Perform arithmetic on shell variables
ln       Make links between files
local    Create variables
locate   Find files
logname  Print current login name
logout   Exit a login shell
lpc      Line printer control program
lpr      Off line print
lprint   Print a file
lprintd  Abort a print job
lprintq  List the print queue
lprm     Remove jobs from the print queue
ls       List information about file(s)
m4       Macro processor
man      Help manual
mkdir    Create new folder(s)
mkfifo   Make FIFOs (named pipes)
mknod    Make block or character special files
more     Display output one screen at a time
mount    Mount a file system
mtools   Manipulate MS-DOS files
mv       Move or rename files or directories
nice     Set the priority of a command or job
nl       Number lines and write files
nohup    Run a command immune to hangups
passwd   Modify a user password
paste    Merge lines of files
pathchk  Check file name portability
popd     Restore the previous value of the current directory
pr       Convert text files for printing
printcap Printer capability database
printenv Print environment variables
printf   Format and print data
ps       Process status
pushd    Save and then change the current directory
pwd      Print Working Directory
quota    Display disk usage and limits
quotacheck Scan a file system for disk usage
quotactl Set disk quotas
ram      ram disk device
rcp      Copy files between two machines.
read     read a line from standard input
readonly Mark variables/functions as readonly
remsync  Synchronize remote files via email
return   Exit a shell function
rm       Remove files
rmdir    Remove folder(s)
rpm      Remote Package Manager
rsync    Remote file copy (Synchronize file trees)
screen   Terminal window manager
sdiff    Merge two files interactively
sed      Stream Editor
select   Accept keyboard input
seq      Print numeric sequences
set      Manipulate shell variables and functions
shift    Shift positional parameters
shopt    Shell Options
shutdown Shutdown or restart linux
sleep    Delay for a specified time
sort     Sort text files
source   Run commands from a file `.'
split    Split a file into fixed-size pieces
su       Substitute user identity
sum      Print a checksum for a file
symlink  Make a new name for a file
sync     Synchronize data on disk with memory
tac      Concatenate and write files in reverse
tail     Output the last part of files
tar      Tape ARchiver
tee      Redirect output to multiple files
test     Evaluate a conditional expression
time     Measure Program Resource Use
times    User and system times
touch    Change file timestamps
top      List processes running on the system
tr       Translate, squeeze, and/or delete characters
traceroute Trace Route to Host
trap     Run a command when a signal is set(bourne)
tree     List the current directory as an ASCII tree
true     Do nothing, successfully
tsort    Topological sort
tty      Print filename of terminal on stdin
type     Describe a command
ulimit   Limit user resources
umask    Users file creation mask
umount   Unmount a device
unalias  Remove an alias
uname    Print system information
unexpand Convert spaces to tabs
uniq     Uniquify files
units    Convert units from one scale to another
unset    Remove variable or function names
unshar   Unpack shell archive scripts
until    Execute commands (until error)
useradd  Create new user account
usermod  Modify user account
users    List users currently logged in
uuencode Encode a binary file uudecode Decode a file created by uuencode
v        Verbosely list directory contents (`ls -l -b')
vdir     Verbosely list directory contents (`ls -l -b')
watch    Execute/display a program periodically
wc       Print byte, word, and line counts
whereis  Report all known instances of a command   
which    Locate a program file in the user's path.
while    Execute commands
who      Print all usernames currently logged in
whoami   Print the current user id and name (`id -un')
xargs    Execute utility, passing constructed argument list(s)
yes      Print a string until interrupted
.        Run commands from a file
#        Start a line comment