Tuesday, July 28, 2015

Rename a Microsoft CRM 2011 Server and it's MSSQL Server

Step1: Edit the MS CRM Config Registry

Step A: Change this registry key
HKLM\SOFTWARE\MICROSOFT\MSCRM\configdb
change:
Data Source=VCRM1;Initial Catalog=MSCRM_CONFIG;Integrated Security=SSPI
to:
Data Source=VCRM2;Initial Catalog=MSCRM_CONFIG;Integrated Security=SSPI

Step B: Change this other registry key
HKLM\SOFTWARE\MICROSOFT\MSCRM\ServerUrl
change:
http://VCRM1/MSCRMServices
to:
http://VCRM2/MSCRMServices

Step 2: Edit the MSCONFIG database ( example VCRM1 to VCRM4 )
use MSCRM_CONFIG;
update dbo.Server set name='VCRM4' where NAME='VCRM1';
update dbo.ConfigSettings set HelpServerUrl='http://VCRM4/' where HelpServerUrl='http://VCRM1/';
update dbo.DeploymentProperties set NVarCharColumn='http://VCRM4.homeslice.net:80' where NVarCharColumn LIKE '%VCRM1:80';
update dbo.Organization set ConnectionString='Data Source=VCRM4;Initial Catalog=HomesliceInsurance_MSCRM;Connection Timeout=60;Integrated Security=SSPI';
update dbo.Organization set SrsUrl='http://VCRM4/reportserver' where SrsUrl='http://VCRM1/reportserver';
update dbo.Organization set SqlServerName='VCRM4';
go



Sunday, July 26, 2015

Bourne Shell Cookbook

Bourne Shell Scripting Cookbook for the masses
1) Numeric for loop
#!/bin/bash
N=10
for (( c=$N; c>0; c-- ))
do
    echo "Counting $c times"
done

Friday, July 10, 2015

Debricking the Western Digital Mybook Live - with a new WD Red Disk

Sometimes it happens, your Western Digital Mybook Live dies and you are left with a blinking blue/green light.  Perhaps it's internal hard disk is making the famous click of death sound.  Rebuild it by purchasing a new 3TB WD Red Drive. Here's how to prepare the new disk, using Ubuntu linux.  I have copied the highlights of the famous debrick script.  Remove the disk from the WD MBL housing, and toss into a landfill or drop into your favourite ocean. Insert new disk in your favourite desktop PC's SATA port, boot with Ubuntu USB drive, and then prepare the new WD disk using these steps.

You should boot from a Live CD or Live bootable USB, so that your disk is /dev/sda.
Assuming that your new disk is /dev/sda

parted /dev/sda --align optimal <<EOP
mklabel gpt
mkpart primary 528M  2576M
mkpart primary 2576M 4624M
mkpart primary 16M 528M
mkpart primary 4624M -1M
set 1 raid on
set 2 raid on
quit
EOP
sync

reboot 

...
mdadm --create /dev/md0 --verbose --metadata=0.9 --raid-devices=2 --level=raid1 --run /dev/sda1 missing
mdadm /dev/md0 --add --verbose /dev/sda2
mdadm --wait /dev/md0
sync
mkdir /mnt/raid1
mount /dev/md0 /mnt/raid1

umount /mnt/raid1
dd if=firmware/rootfs_010507.img of=/dev/md0
mount /mnt/raid1
cp /mnt/raid1/usr/local/share/bootmd0.scr /mnt/raid1/boot/boot.scr
more /mnt/raid1/etc/nas/service_startup/ssh
echo "enabled" > /mnt/raid1/etc/nas/service_startup/ssh
 


mdadm --stop /dev/md0
/root/swap.x /dev/sda1
/root/swap.x /dev/sda2


sync

 

At this point, you may insert the new WD back into the original WD Live chassis.

The Live edition has an onboard JTAG and UART port. Until now I don't know the pinout of the JTAG so be warned to overwrite data in the NAND.
The Pinout of the UART Port "J8" is as follows:
Pin 1 = +3.3V
Pin 2 = URX
Pin 3 = UTX
Pin 4 = GND
Warning: do not connect directly to a serial Port, you will need a ttl level shifter like the "Max233" or "FT232R". Otherwise you risk to break the hardware.
wd_mybook_live_UART.jpg
The UART Port will give you access to the console and during the booting to U-boot.
You will be able to change U-boot parameters, this will allow you to boot anything you want.
I would recommand that you backup the parameters before playing arround.
Baudrate is configured to: 115200
http://mybookworld.wikidot.com/wd-mybook-live-uart

Thursday, July 2, 2015

The WMI Cookbook

WMI Filters to Select Computers to which to apply group policy:

Target Win 7 32 bit machines:
select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"

Target Win 7 64Bit machines:
select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND OSArchitecture = "64-bit"

Target any 32 bit OS;
SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth ='32'

Target any 64Bit OS:
SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth ='64'