penguyen

Technolgy et al

Amazon Glacier is a Tape driven archival storage solution

Posted by penguyen on May 21, 2014


Originally posted on StorageServers:

Amazon Web Services much famous Glacier, which was launched a couple of months ago is a cloud based storage solution offered to the enterprises as a Cloud based archival solution. All the cold data which is not in frequent use in an enterprise can be fed to Glacier and can be retrieved on demand.

All these days, enterprises were maintaining their cold data on tape libraries and had to deal with the painful management and maintenance of these cost efficient storage solutions. In order to ease the job of the enterprise IT team, AWS released Glacier which allowed its users to store data at just one cent per gig/month cost. This cloud based storage solution was termed to be as the low cost archival solution available in the data storage market till date.

Glacier has the potential to accept any amounts of data at a cost that even the traditional…

View original 279 more words

Posted in Uncategorized | Leave a Comment »

The default transaction resource manager on volume C: encountered an error while starting and its metadata was reset. The data contains the error code.

Posted by penguyen on April 23, 2014


The default transaction resource manager on volume C: encountered an error while starting and its metadata was reset. The data contains the error code.

EventID: 134

Log Name: System

Issue: This will happen whenever the Windows file system transaction log is corrupted. The Windows file system uses the transaction log to recover system transactions when a file error occurs.The Common Log File System (CLFS) transaction logs may be left in an inconsistent state. When the CLFS transaction logs are in an inconsistent state

 

Resolution:

delete the .blf files and the .regtrans-ms files from the %Windir%\System32\SMI\Store\Machine folder.

Restart

The run CMD as Admin

at the command prompt type: fsutil resource setautoreset true c:\
Note
 These steps assume that Windows is installed in the default location, on drive C. If this is not the case, adjust the drive letter of the folder path to match your configuration.

 

Posted in Uncategorized | Leave a Comment »

remove stuck mailbox move

Posted by penguyen on August 1, 2013


When Remove-moverequest fails

1. Open ADSIEDIT and navigate to the OU where your broken user account is stored. (Under: Default Naming Context)
2. Locate the user account, right-click on it and then choose “Properties”.
3. Click on the “Filter” button and make sure “Show only attributes that have values” is checked.
4. Scroll down the attributes and search for an entry called “msExchMailboxMoveRemoteHostName”.
5. Click on the “Edit” button.
6. Click on the “Clear” button.
7. Click the “OK” button.

SOURCE: http://www.nonstop.co.il/kb/view.php?kb=66

http://social.technet.microsoft.com/Forums/exchange/en-US/8462635d-0eda-472c-a644-cc2810727288/cant-remove-move-request-failed-to-communicate-with-the-mailbox-database

 

 

 

Posted in Active Directory, Exchange, Windows | Tagged: , | Leave a Comment »

Force removing Exchange 2010 database – ADSIEDIT.MSC

Posted by penguyen on August 1, 2013


Run Get-Mailbox -Database “Database Name” –Arbitration command to find all the arbitration mailboxes

If there are some arbitration mailboxes, move them to different databases and then delete the database again

If all above don’t work, you can use ADSIEDIT tool to delete mailbox database:

1. Open Adsiedit.msc

2. Connect to the configuration partition.

3. Expand Configuration-Services-Microsoft Exchange–Administrative Groups-Servers–Information Stores.

4. Delete the appropriate database.

I ran Set-AdServerSettings -ViewEntireForest $True then ran get-mailbox -database db1 -arbitration and all of a sudden I now see a mailbox!!! How annoying.

I moved the arbitraion mailbox to another DB and I was then able to delete the DB.

I was not aware of the Set-AdServerSettings command.


get-mailboxstatistics -database |fl

Posted in Active Directory, Exchange, Windows | Tagged: , | Leave a Comment »

Resetting the entire registry permission

Posted by penguyen on July 29, 2013


There will be times when you either:

1) Have some sort of malware running on your machine

2) Accidentally changed the permissions of your registry

and needed to reset the registry permissions to default. 

 

Here’s how:

 

download SubInACL from here

SubInACL is a command-line tool that enables administrators to obtain security information about files, registry keys, and services, and transfer this information from user to user, from local or global group to group, and from domain to domain.

Create a file with the name reset.cmd under C:\Program Files\Windows Resource Kits\Tools folder

Now you need to Edit the reset.cmd file and add the following lines

subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f

subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=system=f

Save and exit your file

Now launch command prompt and run the following command

cd “C:\Program Files\Windows Resource Kits\Tools”

after this press enter and enter the following command

reset.cmd

after entering this press Enter

After a few minutes by processing subinacl, the permission will be reset

 

Posted in Windows | Leave a Comment »

Listing Windows Updates using Powershell

Posted by penguyen on September 28, 2012


From Powershell.com

Listing Windows Updates

There is a not widely known COM object that you can use to list all the installed Windows Updates on a machine. Here is the code:

$Session = New-Object -ComObject Microsoft.Update.Session

$Searcher = $Session.CreateUpdateSearcher()

$HistoryCount = $Searcher.GetTotalHistoryCount()

$Searcher.QueryHistory(1,$HistoryCount) |

  Select-Object Date, Title, Description

Posted in Powershell | Tagged: , , , | Leave a Comment »

Exchange SP1 – Previously install failed

Posted by penguyen on August 23, 2011


If you ran an Exchange SP1 install and it failed, once you recovered from the setup /m:recoverserve switch (see my previous blog on how to do this), you may run into this error when trying to re-run SP1 setup again:

” Some controls aren’t valid. Setup previously failed while performing the action “Install”. You can’t resume setup by performaing the action “BuildToBuildUpgrade”.”

It seems that setup thinks that setup never completed. The soluion to this is to delete the registry keys. Open up Registry Editor, and navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\

Here you will see different roles, inspect every single once and locate the reg keys below to delete. For us it was under CAS and Hub roles.

The keys to delete are: Action and Watermark.

Make sure you export the keys for back up before deleting them. Once you delete the keys, setup should continue.

Posted in Exchange | Tagged: | Leave a Comment »

Exchange SP1 Upgrade – Warning

Posted by penguyen on August 22, 2011


Be warned that when you try to upgrade Exchange 2010 to SP1, there is one pre-requisite that is not documented anywhere. The SP1 pre-checks doesn’t see it and if you do not have this setting setup correctly, you will wind up with a broken exchange upgrade, all the exchange binaries will be removed from the server, however, your registry keys for exchange will still be there. You will not be able to reinstall exchange, when you try to use the recovery optin (setup.exe /m:recoverserver) it will also fail. The error that will show up when it fails the SP1 setup would look something like:

The following error was generated when “$error.Clear();
& $RoleBinPath\ServiceControl.ps1 EnableServices Critical
” was run: “AuthorizationManager check failed.”.

To avoid this issue, make sure you set the execution policy Unrestricted, anything else and the upgrade will fail.

First, remove any GP that affects the Exchange server that has the Windows Powershell – Execution Policy turned on
The configuration can be set under:
Computer Configuration -> Policies -> Adminstrative Templates -> Windows Components -> Windows Powershell


Then from the powershell prompt:

PS C:\Windows\system32> get-executionpolicy -list

                                                      Scope                                             ExecutionPolicy
                                                      —–                                             —————
                                              MachinePolicy                                                   Undefined
                                                 UserPolicy                                                   Undefined
                                                    Process                                                   Undefined
                                                CurrentUser                                                   Undefined
                                               LocalMachine                                                RemoteSigned

Change LocalMachine Policy to Unstricted. At the powershell prompt type:

PS C:\Windows\system32> Set-ExecutionPolicy -executionpolicy unrestricted -scope localmachine

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is “Y”): yes

Verify Settings:
PS C:\Windows\system32> get-executionpolicy -list

                                                      Scope                                             ExecutionPolicy
                                                      —–                                             —————
                                              MachinePolicy                                                   Undefined
                                                 UserPolicy                                                   Undefined
                                                    Process                                                   Undefined
                                                CurrentUser                                                   Undefined
                                               LocalMachine                                                   Unrestricted

If you already run into this issue before seeing this post, the only way to get your broken exchange server back into service is to do the followings:
Open the registry editor
Export and delete the following keys
HKLM\SOFTWARE\MICROSOFT\Exchange Server
HKCU\SOFTWARE\MICROSOFT\Exchange Server
Exported – HKLM\System\CCS\Services
Deleted all the keys that start with Msexchange

Rename the Exchange server folder wherein you have installed the exchange binaries

Set IIS, WMI, Remote Registry services back to automatic

Recover the Exchange server by setup.com /m:recoverserver using the RTM binaries. It is best if you can just uninstall Exchange and start anew, but if this is not an option due to some configuration. Use the setup /m:recoverserver

Once you have recovered your Exchange server and validated features are working properly, you can now configure the Exectution Policy as described above and upgrade to SP1.

Seems like Microsoft overlooked this important pre-req. There are no documentations on how people should set Exectution Policy , especially to an Unstricted Policy and not using Group Policy. The Pre-Req checks should have caught this. Also, why on earth did Microsoft not sign their own powershell codes for the SP1 upgrade is beyond my logical comprehension.

Posted in Exchange | Tagged: , , | Leave a Comment »

Searching for text in text files or Powershell Grepping

Posted by penguyen on March 29, 2011


Ask any linux admin and they’ll tell you how useful grep is. Grep is a command in linux allow you go search through piped outputs and/or files for certain strings. Grep also allows for the use for regular expression to search for more complex criterias. For a long time Microsoft users have not have such feature until now with the introduction of Powershell. To search a directory of files for a certain string at the powershell prompt type:

dir | select-string “string to search”

or to use regular expressions:

dir | select-string “regex”

if you just want to look for the filename of the files that contains certain strings and not the strings themselves:

dir prefix*

to comb through all sub-directory of the current directory:

dir -recurse | select-string “string to search”

For further selection or filter of you search, you can pipe the result of the previous pipe:

dir -recurse | select-string “string to search 1″ | select-string “string to search 2″

In the example above, it’s the equivalent of saying “Search for the first string, then in the results of the first string search for the second string and ONLY show the output of that”. Kind of like using the AND operant.

Other ways of getting the same results:

select-string -path “c:\text files\*.txt” -pattern “patter to search here” -simplematch -showall

This will only show the objects your searching for, for the line property (showing the whole line) type:

select-string -path “c:\text files\*.txt” -pattern “patter to search here” -simplematch -showall | select line

Posted in Powershell | Tagged: , , , | Leave a Comment »

Asterisk Failover (Virtual IP) solution

Posted by penguyen on March 29, 2011


I have been searching for a solution that allows for a cluster of Asterisk servers to co-operate and fail over as necessary. Usually with the original configuration of Asterisk, if configured correctly, will restart itself automatically should the instance crashes. This results in somewhat of a resilient server that recovers itself, the downside is that most of the time all the calls will have been disconnected. That may seem alright for a small company, but for larger organization this could mean hundreds of customer service calls getting disconnected. Also, if the server experience some type of hardware (HD, CPU, PS) failure there’s no chance that the server will come back up within a short time frame. In a perfect world, the cluster would keep track of all concurrent calls and transfer them over to a different server soon after the failure before the SIP session times out and disconnect all calls. I have yet to find a solution that will work like that for Asterisk. However, I’ve found a solution that will allows for a failover in case of a hardware failure. Yes, calls will get disconected but at least the organization will be able to continue to function until the affected server is recovered.

CREDIT: Credit goes to Gregg Hansen, creator of this solution and author of http://www.thiscoolsite.com

Requirements:
1) nmap
2) arping
3) download the two scripts located of Gregg’s site:  flip1405_primaryflip1405_secondaryor copy and paste the scripts at the end of this page

Steps (copy and pasted from Gregg’s Site):
1) Create a cron.every1 folder on each server, copy flip1405_primary and flip1405_secondary to their respective servers.
2) Make sure you edit the files with your IP addressing scheme. I commented what you need to find and replace.
3) Setup shared-keys so the servers can copy between each other without user intervention. (
Setup Login without password)
4) Schedule a “rsync -avz /etc/asterisk/* root@secondaryIP:/etc/asterisk”
To replicate the configs from the primary to the secondary every 30 minutes or so (another cronjob).
You also can use the same command (diff dir) to replicate all other files, sounds, VM, etc.)

This works out so you can reboot your primary box, the secondary will take over for the time being. As soon as the primary is up, the secondary will resume slave/standby mode.

SCRIPTS:
flip1405_primary

#!/bin/sh
#FLIP1405 - Failover Server Solution
#RUN ON PRIMARY ASTERISK SERVER
#AUTHOR-GREGG HANSEN 20080208
#DEPENDENCIES: nmap, arping
#
#Do a find and replace on the following IP with your Virtual IP
#192.168.5.30  =  VIRTUAL IP

STATUS=$(nmap -p 5060 -sU 127.0.0.1 | awk '{print $2}' | grep open)                     #if Local Asterisk up = 'open|filtered'
PRIMARYIP=$(ifconfig eth0:1 | grep 192.168.5.30 | awk '{print $2}' | sed 's/addr://g')   #if primary owns virtual = '192.168.5.30' 
VIRTUALIP=$(nmap -sP 192.168.5.30 | grep down | awk '{print $4}')                      #if virtual is not pingable = 'down.'

if [ "$STATUS" == "open|filtered" ] ; then  ###is primary asterisk up?   
	if [ "$PRIMARYIP" != "192.168.5.30" ] ; then  ###does primary not own virtual ip?
		if [ "$VIRTUALIP" == "down." ] ; then  ###is the virtual IP not pingable?
		       ifconfig eth0:1 192.168.5.30/24 up
			arping -U -c 5 -I eth0 192.168.5.30  ###Gratuitous ARP request
		fi
	fi
else
	service asterisk start
	ifconfig eth0:1 down
fi

flip1405_secondary

#!/bin/sh
#FLIP1405 - Failover Server Solution
#RUN ON SECONDARY ASTERISK SERVER
#AUTHOR-GREGG HANSEN 20080208
#DEPENDENCIES: nmap, arping
#Find and Replace the following IPs with your IP scheme:
#192.168.5.30  = Virtual IP
#192.168.5.31  = Real IP Server 1

PRISTATUS=$(nmap -p 5060 -sU 192.168.5.31 | awk '{print $2}' | grep open)                     ###if Primary Asterisk up = 'open|filtered'
SECSTATUS=$(nmap -p 5060 -sU 127.0.0.1 | awk '{print $2}' | grep open)			    ###if Secondary Asterisk up = 'open|filtered'
PRIMARYIP=$(ifconfig eth0:1 | grep 192.168.5.30 | awk '{print $2}' | sed 's/addr://g')   ###if local owns Virtual = '192.168.5.30' 
VIRTUALIP=$(nmap -sP 192.168.5.30 | grep down | awk '{print $4}')                      ###if Virtual not pingable = 'down.'

if [ "$PRISTATUS" != "open|filtered" ] ; then   ###is primary asterisk down?
	if [ "$SECSTATUS" == "open|filtered" ] ; then     ###is secondary asterisk up?     
		if [ "$PRIMARYIP" != "192.168.5.30" ] ; then   ###does secondary not own virtual ip?
			if [ "$VIRTUALIP" == "down." ] ; then  ###is the virtual IP not pingable?
		       ifconfig eth0:1 192.168.5.30/24 up
			arping -U -c 5 -I eth0 192.168.5.30   ###Gratuitous ARP request
			fi
		fi

	else
		service asterisk start
	fi
else
	if [ "$SECSTATUS" == "open|filtered" ] ; then ###primary is up, is secondary up? (there can be only one!)
		service asterisk stop
	else
 			if [ "$PRIMARYIP" == "192.168.5.30" ] ; then ###primary is up, do we still have the virtual ip?
			ifconfig eth0:1 down
			fi
	fi
fi

 

Posted in Asterisk, VoIP | Tagged: , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 413 other followers