Quickly create an MD5 string in linux.

$ echo -n “mysupersecretpassword” | md5sum
117a520adbd19eff51100215aa7a7fbf –

I had to use this to change the Joomla 3 password stored in a MySQL database that I forgot for the only account I had created.

MySQL> UPDATE wxyz_users SET PASSWORD=’117a520adbd19eff51100215aa7a7fbf’ WHERE username=’myadminaccount’;

Exchange mailbox error – get-mailbox

I got the following error when trying to look at mailbox using EMS from an Exchange 2010 server. The mailbox was on an Exchange 2003 server.

WARNING: The object MY.DOMAIN/MYOUs/Firstname Lastname has been corrupted, and it’s in an inconsistent state. The following validation errors happened:
WARNING: Property expression “FLastname” isn’t valid. Valid values are: Strings that includes ‘@’, where ‘@’ cannot be the last character

It turns out that this issue was the userPrincipalName attribute for the user. It probably was missed in the migration from a Windows NT4 environment to Windows 2000/2003. I simply used ADSI Edit to add the @MY.DOMAIN to the end of current attribute setting, and all was well.

Unable to ssh into Cisco PIX or ASA

After a reboot of our Cisco PIX I was unable to login remotely using ssh. The first thing I tried doing was to remove the the pix entry from my ~/.ssh/known_hosts file. This did not work.

The only way I have found to gain access again is to regenerate the RSA key from the console:

MYPix (config)# ca zeroize rsa
MYPix (config)# ca generate rsa key 1024
MYPix (config)# ca save all

For a Cisco ASA:

MyASA (config)# crypto key generate rsa modulus 2048
MyASA (config)# write memory

Initiate Printer Creation From Command Line in Windows

To setup a network printer that is created and shared on SERVERNAME:

RUNDLL32.EXE printui.dll,PrintUIEntry /in /n\\SERVERNAME\PRINTERSHARENAME

To set that printer as the default printer:

RUNDLL32.EXE printui.dll,PrintUIEntry /y /n\\SERVERNAME\PRINTERSHARENAME

This can be useful to help somebody get a printer connected easily using a script.

More info: https://technet.microsoft.com/en-us/library/ee624057.aspx

Exchange 2010 – Trouble accessing the Exchange Control Panel (ecp)

While trying to access the Exchange Control Panel (https://exchangeserver/ecp), I kept getting the following error:

“Sorry! We’re having trouble processing your request right now. Please try again in a few minutes.”

Outlook Web Access (https://exchangeserver/owa) worked fine.

Thanks to jhoskins for the following post that provided the solution:
http://www.moderncs.net/node/98

As mentioned in the post, I was also running Exchange 2010 on Windows 2012 server.

Since OWA was working, it just a matter of getting the ECP Application Pool in IIS to use the same version of .Net Framework. When the ECP was not working, the MSExchangeECPAppPool Application Pool was set to use version 4.0.30319. I simply changed it to version 2.0.50727 like the MSExchangeOWAAppPool was set, and it started working fine.

Exchange 2010 – Receive Connectors

To configure Exchange relay mail from something that is not another Exchange server, you will need to create an additional Receive Connector. The best approach is probably to create and named them based on authentication or Permission Groups. That way, if you need to add another later, it will easy to identity where you need to be and what you need to do. For example, you might name one “Anonymous No Auth” or “Anonymous TLS”.

To create a new Receive Connector, open the EMC (Exchange Management Console) and under “Server Configuration”, select “Hub Transport.” Select the Exchange server under in “Hub Transport” window in the top of the screen. This is show you all of your current Receive Connectors. In the Actions (right side of the screen), select “New Receive Connector …”

Name: Anoymous TLS
Select the intended use for this Receive connetor: Custom
Next

Local Network settings:
Next

Remote Network settings:
Select 0.0.0.0-255.255.255.255 and hit the red X to remove it. Then, add the IP or IP Range for which you want the connector to apply.
Next

New

Then, in the bottom window pane, you will the newly created Receive Connector. Right mouse click on it and go to Properties. Click on the “Authentication” tab. TLS should be selected by default. If you want no authentication for this connector (not recommended of course), you would uncheck TLS leaving nothing checked here.

On the “Permission Groups”, check “Anonymous users”.
Ok

In Exchange 2013, Receive Connectors are under “Mail Flow” in the ECP.

Android M on a Nexus 6 – General Nexus 6 Android Installation

OS: Mac OS Mavericks

If you want to flash your Android 5 device with a new system image, you will more than likely need to unlock the bootloader. This is done by enabling the OEM unlock.

You will need the developer’s SDK for the tools needed: https://developer.android.com/sdk/index.html

After you install the SDK, it will make things easier if you add the location of the tools needed to your PATH variable. Note: you will probably need to create the .bash_profile file. One does not exist by default in Mavericks.

$ cat ~/.bash_profile
export PATH=$PATH:/Users/username/Library/Android/sdk/platform-tools

Plug your phone in using the USB cable. Note: I have had some issues with different micro USB cables. I would use the one that came with phone if possible.

You can try the OEM unlock by issuing the following command. This did not work for me with a Nexus 6. Instead, I unlocked it from the Developer options.

$ fastboot oem unlock

Enabling Developer options:

Go to “Settings” and then “About Phone”, and tap the firmware version several times. You will get a countdown for the number of taps to get you into Developer mode. Go back to “Settings” and notice that you now have a “Developers options” option. Select it and turn on OEM unlocking. You might have enter your phone unlock PIN and then confirm to enable.

Turn off the phone. Hold down volume button on the volume rocker and power button at the same time. This will put your phone into transfer mode.

Download the Android M preview system image from: https://developer.android.com/preview/download.html
Other available system images for when you want to switch back: https://developers.google.com/android/nexus/images

Uncompress the downloaded shamu-MPZ44Q-preview-c1d6506a.tgz file by double clicking it in Finder.

Using Terminal go to the location where you saved and uncompressed the download. The directory will be called shamu-MPZ44Q. In that directory, unzip image-shamu-MPZ44Q.zip.

Install Android M:

./flash-base.sh
fastboot flash recovery recovery.img
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash cache cache.img
fastboot flash userdata userdata.img
fastboot reboot

Here is what the output should look like:

flash_base.sh:

$ ./flash-base.sh
target reported max download size of 536870912 bytes
sending ‘bootloader’ (3807 KB)…
OKAY [ 0.187s]
writing ‘bootloader’…
(bootloader) flashing partition …
(bootloader) This may take a few seconds if a
(bootloader) different partition table is being
(bootloader) flashed since we need to backup
(bootloader) and restore a few partitions
(bootloader) Flashing primary GPT image…
(bootloader) Flashing backup GPT image…
(bootloader) flashing aboot …
(bootloader) flashing sbl1 …
(bootloader) flashing rpm …
(bootloader) flashing tz …
(bootloader) flashing sdi …
(bootloader) flashing logo …
OKAY [ 0.358s]
finished. total time: 0.545s
rebooting into bootloader…
OKAY [ 0.001s]
finished. total time: 0.001s
target reported max download size of 536870912 bytes
sending ‘radio’ (67556 KB)…
OKAY [ 2.965s]
writing ‘radio’…
(bootloader) flashing modem …
(bootloader) flashing mdm1m9kefs1 …
(bootloader) flashing mdm1m9kefs2 …
(bootloader) flashing mdm1m9kefs3 …
(bootloader) flashing versions …
OKAY [ 0.739s]
finished. total time: 3.704s
rebooting into bootloader…
OKAY [ 0.001s]
finished. total time: 0.001s

recovery.img:

$ fastboot flash recovery recovery.img
target reported max download size of 536870912 bytes
sending ‘recovery’ (8877 KB)…
OKAY [ 0.444s]
writing ‘recovery’…
OKAY [ 0.118s]
finished. total time: 0.562s

boot.img:

jimsmac:temp jgz$ fastboot flash boot boot.img
target reported max download size of 536870912 bytes
sending ‘boot’ (8161 KB)…
OKAY [ 0.406s]
writing ‘boot’…
OKAY [ 0.087s]
finished. total time: 0.493s

system.img:

$ fastboot flash system system.img
target reported max download size of 536870912 bytes
sending sparse ‘system’ (517183 KB)…
OKAY [ 31.545s]
writing ‘system’…
OKAY [ 5.282s]
sending sparse ‘system’ (523718 KB)…
OKAY [ 32.352s]
writing ‘system’…
OKAY [ 5.009s]
sending sparse ‘system’ (522246 KB)…
OKAY [ 31.508s]
writing ‘system’…
OKAY [ 4.846s]
sending sparse ‘system’ (370015 KB)…
OKAY [ 23.730s]
writing ‘system’…
OKAY [ 3.407s]
finished. total time: 137.691s

cache.img:

$ fastboot flash cache cache.img
target reported max download size of 536870912 bytes
erasing ‘cache’…
OKAY [ 0.035s]
sending ‘cache’ (6248 KB)…
OKAY [ 0.329s]
writing ‘cache’…
OKAY [ 0.083s]
finished. total time: 0.447s

userdata.img:

$ fastboot flash userdata userdata.img
target reported max download size of 536870912 bytes
erasing ‘userdata’…
OKAY [ 2.290s]
sending ‘userdata’ (138868 KB)…
OKAY [ 6.092s]
writing ‘userdata’…
OKAY [ 2.058s]
finished. total time: 10.440s

reboot:

$ fastboot reboot
rebooting…

finished. total time: 0.022s

You can use the same procedure to downgrade your phone back to Lollipop using one of the downloads at https://developers.google.com/android/nexus/images.

Mount SMB/CIFS share at boot in CentOS 7.

Mounting a Windows (CIFS) file share in CentOS 7 has changed a little when using a Windows domain to authenticate.

First, you need to have the cifs-util package installed. This will allow you to mount cifs/smb filesystems.

The syntax in the /etc/fstab has not changed, but the way the credential options are stored for domains is a little different. I use a hidden file that is read only to store the Windows credentials.

/etc/fstab:

//winserver/sharename /mntpoint cifs credentials=/usr/local/etc/.myfile,iocharset=utf8,file_mode=0774,dir_mode=0774 0 0

Here is the change. In the past, I was able to specify the domain with the username in the credential file like so:
/usr/local/etc/.myfile:

username=mydomain\myusername
password=mypassword

Now, the domain needs to be specified on its own line like so:

username=myusername
password=mypassword
domain=mydomain

Windows Remote Process Kill

Ever need to kill a process on a remote Windows computer that you can’t login to and the user is not there? Taskkill can help. I am not sure when this utility was introduced, but I would think it is on Windows 7. I did this from a Windows 8.1 machine.

You can do it by PID:

taskkill /S computernameORipaddress /u username /PID pidnumber

Or executable image name:

taskkill /S computernameORipaddress /u username /FI “IMAGENAME eq imagename”

Here is an example. This kills Outlook on a computer with an IP address of 10.10.10.10 using the Administrator account:

C:\>taskkill /S 10.10.10.10 /u Administrator /FI “IMAGENAME eq outlook.exe”
Type the password for administrator:********

SUCCESS: The process with PID 2576 has been terminated.

Exchange 2010 Mailbox Recovery

Restore the database files to a location with enough space to hold the entire database and its logs. I created a full system (bare metal) backup using Windows Server Backup. I recovered using the following options:
Select Recovery Type: Applications
Select Application: Exchange
Specify Recovery Options: Recover to another location
Under Confirmation, I presume you would be able to choose the database you want to restore. I only had one, so it was selected.

This will restore the database and logs to the location you specified. I suspect the process will be very similar for other backup solutions that support Exchange.

Check database State:

[PS] >eseutil /mh ‘E:\WSBRecovery\Mailbox Database 1234567890\Mailbox Database 1234567890.edb’

Filter output for the State:

[PS] >eseutil /mh ‘E:\WSBRecovery\Mailbox Database 1234567890\Mailbox Database 1234567890.edb’ | findstr “State”

Check status of the logs:

[PS] >eseutil /ml ‘E:\WSBRecovery\Mailbox Database 1234567890\E00’

Replay the logs and update the database. The /l option is the log location, and the /d is the database location.:

[PS] >eseutil /r E00 /i /l ‘E:\WSBRecovery\Mailbox Database 1234567890’ /d ‘E:\WSBRecovery\Mailbox Database 1234567890’

Check the State again. It should be Clean Shutdown now.:

[PS] >eseutil /mh ‘E:\WSBRecovery\Mailbox Database 1234567890\Mailbox Database 1234567890.edb’ | findstr “State”

If the State still say Dirty Shutdown, you can try to repair the database. However, this should be your last resort:

[PS] >eseutil /p ‘E:\WSBRecovery\Mailbox Database 1234567890\Mailbox Database 1234567890.edb’

Create a new recovery database using the restored clean database:

[PS] >New-MailboxDatabase RecoveryDatabase -Server MY-EXCHG01 -Recovery:$true -EdbFilePath ‘E:\WSBRecovery\Mailbox Database 1234567890\Mailbox Database 1234567890.edb’ -LogFolderPath ‘E:\WSBRecovery\Mailbox Database 1234567890’

Mount the recovery database:

[PS] >Mount-Database RecoveryDatabase

If you have an old recovery database open, you may need to dismount the old and delete it first. Not sure if that is applicable for all Exchange versions, but this was the case in Exchange Server 2010 Standard version:

[PS] >Dismount-Database ‘MY-EXCHG01 DB01 Recovery’
[PS] >Remove-MailboxDatabase -Identity ‘MY-EXCHG01 DB01 Recovery’

Check for the mailboxes in the recovered database:

[PS] >Get-Mailboxstatistics -Database RecoveryDatabase

Restore the database to a Restore folder, so the lost messages can be copied from the Restore folder. Once the lost messages are moved out of the Restore folder, the Restore folder can be deleted.

[PS] >Restore-Mailbox -Identity “JGZ Test” -RecoveryDatabase RecoveryDatabase -RecoveryMailbox “JGZ Test” -TargetFolder Restore

If you are restoring a mailbox for one user and putting it in another users mailbox, you need to make sure you have the order right.
Identity is the mailbox you are going to be restoring to (target), and the RecoveryMailbox is the mailbox you are restoring (source).

[PS] >Restore-Mailbox -Identity “put-IT-here” -RecoveryDatabase RecoveryDatabase -RecoveryMailbox “get-IT-here” -TargetFolder Restore

:

Return top

INFORMATION