Sunday, August 5, 2012

WSUS troubleshooting


1- Check computer location
-install adminpack to be able to run the below: http://www.microsoft.com/download/en/details.aspx?id=16770

-query the active directory

C:\>dsquery computer -name 1f-gm-90016
"CN=1F-GM-90016,OU=Mana,OU=Computers,OU=ABC,DC=ABC,DC=bh,DC=com"

this mean the computer location is in its correct OU, so it may recieves the updates.


if OK , then try:

2- Check which group policy applied on the respective OU.
Download http://www.microsoft.com/download/en/details.aspx?id=21895
if you got an error like that:
ignore Checkpoin N# 2 mark that computer for last review with (2)



3- Check the log file "locally" on computer.
c:\WINDOWS\WindowsUpdate.log

if OK ,& computer is still not recieving udates  you "the file can tell or after you run the html command" you  may try:

4- Resetting the Windows updates "steps i nE-mail sent to sayed"
Reset WSUS Client
1.    run "net stop wuauserv"
2.    run "net stop bits"
3.    Clear the contents of C:\Windows\SoftwareDistribution
4.    Clear the contents of C:\Windows\WindowsUpdate.log
5.    run "net start wuauserv"
6.    run "net start bits"
7.    run "wuauclt /detectnow /resetauthorization"

Saturday, August 4, 2012

My DataDOmain Quick Commands


autosupport show report

==========  GENERAL INFO  ==========
GENERATED_ON=Sun Aug  5 08:40:00 AST 2012
VERSION=Data Domain OS 5.1.0.5-269447
SYSTEM_ID=1UR2352365
MODEL_NO=DD640
HOSTNAME=dd01.ABC.bh.com
LOCATION=ABC MAIN
ADMIN_EMAIL=ABCalerts@ABC.com.bh
UPTIME= 08:40:00 up 104 days, 19:26,  1 user,  load average: 2.10, 2.08, 2.08
Filesystem has been up  95 days, 13:17.

=======
Upgrading OS:
-----------



++Upgrade Steps:

1- Ensure there is no cleaning or backups running.
#filesys clean show
#iostat 2

2- Reboot the Data Domians prior to upgrade with command #system reboot

3- Ensure there is no current alerts
#alerts show current

4-  Start the upgrade
#system upgrade 5.1.1.0 (use the full file name with extension)

5- Data Domains will reboot after upgrade
6- File System will take some time to come back online.
7- Once File System is online, let us know so we can work on the replication.

Wednesday, August 1, 2012

My Avamar Commands ref.


To restart mcs + ems following the command:
1. login as user admin and loaded keys with
ssh-agent bash
ssh-add ~admin/.ssh/dpnid
2. following the command to stop mcs + ems service.
emserver.sh --stop
mcserver.sh --stop
3. make sure there is no mcs and ems process running, kill the process if still exist
ps -ef | grep mcserver
ps -ef | grep emserver
4. restart the mcs and ems service, use --ignore_lock only after you have looked around and you have determined that it is safe to break the lock
emserver.sh --start (--ignore_lock)
mcserver.sh --start (--ignore_lock)

======================



Getting an overview about your Avamar Box:

su – admin

ssh-agent bash

ssh-add /home/admin/.ssh/dpnid



status.dpn

capacity.sh

mccli server show-prop



======================
Expire Avamar Backup commands:

=======================

1st way#
----------

-          Please find below the steps to run the expire-snapups script to expire backups in a date range:

The expire-snapups command writes a script to stdout, which when run, changes backup expiration dates.

Synopsis:
expire-snapups [--after=DATE] [--before=DATE] [--days=NUM][--domain=DOMAIN] [--help] [--include_mc_backups][--replicate --dstserver=SERVER --dstid=USER@PATH--dstpassword=PASSWORD [--dstdomain=DOMAIN]] [CLIENT-PATH ...]

You can use “expire_snapups” script which will set the expiration date after x days so you can run it as the following for example:

Example:
# expire-snapups --before=20130201 --domain=/ --days=1 > expire-backups-out
This will set the expiration date for all backups under ”/” domain which are created before “Feb 1, 2013” for one day so the GC will recover them the following day.  Please note to load the dpn keys before running the script:

After creating a script with the desired backup deletion parameters, type the following to delete the backups from the Avamar server:
# /bin/sh -x ./expire-backups-out





Change the expiration date of these backups please follow the below steps to execute the expire-snapups output :
1)    Login to the utiliy node as user admin.
2)    Load the ssh-keys :
# ssh-agent bash
# ssh-add /home/admin/.ssh/dpnid
3)    /bin/sh -x ./expire-before-march
4)    /bin/sh –x ./expire-after-march 

 ---------------------------------------------------------------------------------------------------
2nd Way# 
-----------
1) Find a list of domains on the Target server
-mccli domain show --recursive=true --domain=/

2) Run delete snapups script against each domain to get a list of commands to delete backups before a certain day (20131023) these backups are belong  to all clients under this domain
The o/p will be appended to a file in our case delete-backups-out
-delete-snapups --before=20131023 --domain=/REPLICATE/ABCavmr01/172.16.1.150/VirtualMachines > delete-backups-out

3) Run the o/p file to delete the backups
-/bin/sh –x ./delete-backups-out

Please remove the file once it is done
-rm delete-backups-out

4) The last 2 steps have been repeated against the below domains in green

5) Run Garbage collection to free space
- Our recommendation is to leave the scheduled GC to run and decrease the utilization
- I have run manual GC to save some time and now capacity is 83.8 % and GC is still in progress
- I have increased the blackout window to be 6 hours to give more time for the gc to run and decrease space
- we can get this value back to default 3 hours after the utilization decreased

Note:
- I have stopped the replication from the source to prevent adding more data

After the GC finish run the below commands

- avmaint config --ava indexcacheallowed=1
- dpnctl start maint

Please run step 2 and 3 against the domains you want to delete and leave the scheduled GC to free space
You have to run the scripts before the GC start to take effect,  GC start at 8 AST
You can’t run the script while the server in read only mode (GC or CP running)

Here is a list of all the domain on the target

admin@ABCdravmr01:~/>: mccli domain show --recursive=true --domain=/
0,23000,CLI command completed successfully.
Name            Domain                            Contact Phone Email Location
--------------- --------------------------------- ------- ----- ----- ----------------------------------------
clients         /                                                     667be9cfc196f6ce999c415c0e9f939195df3def
MC_RETIRED      /                                                     bf5a0b9e203241fcd48885443ef68e0bc1c61938
REPLICATE       /                                                     7031d2a28a5a7e66ef9dd2ea0976b111f9961926
ABCavmr01       /REPLICATE                                            e9ea29a9ae1f8bb6fd173062aec3cd9b7d85d5ba
10.7.1.79       /REPLICATE/ABCavmr01
172.16.1.150    /REPLICATE/ABCavmr01
172.16.1.155    /REPLICATE/ABCavmr01
clients         /REPLICATE/ABCavmr01                                  8891c95079331fa504c9f2dacec74cf6e6fbffb2
MC_RETIRED      /REPLICATE/ABCavmr01                                  155a7c1f962f548d16bfcdc2ccb0ff3f01c5a29e
NDMP_DM2        /REPLICATE/ABCavmr01
Physical        /REPLICATE/ABCavmr01
proxy           /REPLICATE/ABCavmr01
VirtualMachines /REPLICATE/ABCavmr01/10.7.1.79
VM-Backup       /REPLICATE/ABCavmr01/10.7.1.79
Temp.Backup     /REPLICATE/ABCavmr01/172.16.1.150
VirtualMachines /REPLICATE/ABCavmr01/172.16.1.150
VM-Group1       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group2       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group3       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group4       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group5       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group6       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group7       /REPLICATE/ABCavmr01/172.16.1.150
VM-Group8       /REPLICATE/ABCavmr01/172.16.1.150
VirtualMachines /REPLICATE/ABCavmr01/172.16.1.155
proxy           /REPLICATE/ABCavmr01/clients

Tuesday, June 12, 2012

My Networker Command

Delete Volumes Command:

  nsrmm -v -d VolumeName
using Excel I sort them out by Volumes IDs then paste the script , a piece of cake.
i.e:
=CONCATENATE("echo YES | nsrmm -v -d ",C2)

===============

Debugging auto-changer operations

nsradmin
print type: NSR jukebox
update debug trace level: 9
print
 
 ================
 Load without mount:
 nsrjb -l -f /dev/rmt/9cbn -S KR130
=================
Restart Networker Srvices:
/etc/init.d/networker start      -- or / stop
/etc/init.d/gst start

=================

On any NMM client:
To query :
nsrnap_vss_save -v -?
& then
vssadmin list writer

to change the NSR logs to redable format: from command :
nsr_render_log  nmm.raw > nmm0604.txt

==============

List the aborted savesets:
mminfo -q "ssid=Aborted_Saveset_ID" -r "volume,ssid,cloneid"
Deleted the aborted Savesets:
nsrmm -d -S ssid/cloneid
=================
monitor the size of the volumes:
mminfo -m | grep –I VOLUMENAME

==========

Backup Single Client in networker
savegrp -vvv -c ClientName GroupName

=======================


Display ‘nsrclone’ process listed in task manager window
ps –ef |grep nsr

=======================





Monday, June 11, 2012

My Avamar Commands

 dpnctl.status

./proactive_check.pl   (proactive_check.pl 2.58)
Then   cat hc_results.txt
 status.dpn



Tuesday, November 15, 2011

My Active Directory command Webstore :)

Extract All Users information from AD using CSVDE:
CSVDE -f C:\ADExport\ADAllUsers.csv -r "(&(objectClass=user))"

Extract All Groups information from AD using CSVDE

CSVDE -f C:\ADExport\ADAllGroups.csv -r "(&(objectClass=group))"

Extract Specific Groups from AD using CSVDE
csvde -f C:\ADExport\AdministratorsGroup.csv -r "(memberOf=CN=Administrators,CN=Builtin,DC=abc,DC=co,DC=com)"

csvde -f C:\ADExport\DomainAdminsGroup.csv -r "(memberOf=CN=Domain Admins,OU=Groups,DC=abc,DC=co,DC=com)"

csvde -f C:\ADExport\ENTAdminsGroup.csv -r "(memberOf=CN=Enterprise Admins,OU=Groups,DC=abc,DC=co,DC=com)"

Sunday, October 2, 2011

My Exchange Powershells

Grant a user calender permission Exchange 2010
[PS] C:\>Add-MailboxFolderPermission amalik@elgendi.com:\Calendar -User skamel@elgendi.com -AccessRights editor


RunspaceId : 23325030-1dac-4fae-9c97-75380d4b7f2e
FolderName : Calendar
User : Sonia Kamel
AccessRights : {Editor}
Identity : SSonia Kamel Blablabla
IsValid : True


[PS] C:\>Add-MailboxFolderPermission amalik@elgendi.com:\Calendar -User pPoPs@elgendi.com -AccessRights editor


RunspaceId : 23325030-1dac-4fae-9c97-75380d4b7f2e
FolderName : Calendar
User : Paul PoPs
AccessRights : {Editor}
Identity : Paul Pops Blablabla
IsValid : True

------------------------------------------------------------------------------------------------------------

How to delete E-mail from all Mailboxes

In Exchange 2010 till Sp1

Get-Mailbox –Database ABC-3GB | Export-Mailbox -Identity asabry@elgendi.com –SubjectKeyWorks "Good Morning" –SenderKeyWorks "Ahmed Sabry" -DeleteContent


------------------------------------------------------------------------------------------------------------



Exchange 2010 powershell - get messages sent / received:

Get-MessageTrackingLog -recipient “123@domain.com” -eventID send -Start “05/01/2011 1:00AM” -End “06/23/2011 1:00am”
| Select timestamp,recipients,messagesubject




------------------------------------------------------------------------------------------------------------



In Exchange 2010 SP2
Search-Mailbox -Identity "Ahmed Sabry" -SearchQuery 'Subject:"Remove CMDLET"' -DeleteContent
I didnt like it as I can not specify the sender parameter, it deleted 5 messages , I was willing to delete only 1



 Message Tracking Results using Powershell

Get-MessageTrackingLog -Start "10/02/2011 00:00AM" -Sender "rajawi@ABC.com.it" > I:\test\rajawi2Oct.txt

------------------------------------------------------------------------------------------------------------

Get Exchange Database users Mailbox Size

Get-MailboxStatistics -Database K100MB | Sort-Object TotalItemSize -Descending | ft DisplayName,TotalItemSize,ItemCount > C:\Temp\Exchange\K100MB.txt


------------------------------------------------------------------------------------------------------------


Get Exchange DB & Log file locations:
Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize,EdbFilePath,LogFolderPath


------------------------------------------------------------------------------------------------------------


Quick checkup commands  :


test-replicationhealth
Get-MailboxDatabaseCopyStatus    :  ContentIndex State failed for “ABC-MB-01”
Test-ServiceHealth -Server  ABC-MB-02
Get-Queue -ServerABC-MB-02 | FL
Test-Mailflow ABC-MB-02 -TargetMailboxServer ABC-MB-01


------------------------------------------------------------------------------------------------------------

Export Mailbox command:

First grant the permission:

New-ManagementRoleAssignment -Role "Mailbox Import Export" -User aelgendi

Second export the Mailbox:
New-MailboxExportRequest -Mailbox "mquddus@abc.com.kw" -FilePath "\\10.7.1.42\OLpst\AbboITSMail.pst"

if you got an error you may need to clean the Database.

Get-Mailboxdatabase | Clean-MailboxDatabase

you can list disconnected by Databse:
Get-MailboxStatistics -Database ABC_DB | Where { $_.DisconnectReason -eq "SoftDeleted" -or $_.DisconnectReason -eq "Disabled" } | Format-List LegacyDN, DisplayName, MailboxGUID, DisconnectReason


=====================================================================
Get list of users by GB:
***
Get-MailboxStatistics -Server ABC-mb-01 | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –

Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (GB)”;expression=

{$_.TotalItemSize.Value.ToGB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression=

{$_.StorageLimitStatus}} -auto > C:\PShellOutputs\sMailboxStatisticsREPORT.txt

Get list of users by MB:
***
Get-MailboxStatistics -Server ABC-mb-01 | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –

Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression=

{$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression=

{$_.StorageLimitStatus}} -auto > C:\PShellOutputs\sMailboxStatisticsREPORT.txt


If Mailbox is not appearing in disconnecrted mailbox:
Get-Mailboxdatabase | Clean-MailboxDatabase


****Determining Free Space in an Exchange 2010 Mailbox Database
Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto


** Top 20 Mailbox in Size:
Get-Mailbox -database "ABC_100MB" -ResultSize Unlimited| Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 20 > c:\PShellOutputs\ABC_100MB.txt


Get-Mailbox -database "ABC_500MB" -ResultSize Unlimited| Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 20 > c:\PShellOutputs\ABC_500MB.txt


Get-Mailbox -database "ABC_UNLIMITED" -ResultSize Unlimited| Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 20 > c:\PShellOutputs\ABC_UNLIMITED.txt


Get-Mailbox -database "ABC_1GB" -ResultSize Unlimited| Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 20 > c:\PShellOutputs\ABC_1GB.txt

==========================================================================

Migrating users to new Mailbox Database , Zero down time:

1. Assign two new drives to the active server one for DB and one for Log
2. Create a new database and point to the new drives
3. Change the Database logging level to ‘Circular logging’ on the new database
4. Move the users from KFH_1GB to the new database
5. After all the users are moved delete the old database
6. Remove the ‘circular logging’ from the new database
7. Reconfigure the drive letters on the passive node to match the new DB and log drives
8. Add the new database copy to the passive node


===========================================================
After NLB configuration you may need to run this command if the servers are not responding:
 netsh interface ipv4 set interface "NLB" forwarding=enabled