Thursday, October 31, 2013
Changing Network Location on Windows 2008R2/2012
This is annoying because the 'public domain' firewall then starts blocking all unknown incoming traffic to my server.
We need to change this network location to be domain. However sometime, the location name is not clickable!!
To fix this, I found a trick:
Navigate to this network properties and un-tick the Internet Protocol Version 6 (TCP/IPv6) stack
Click OK
Then it should change the network location type to domain
Now you can change the IPv6 stack back ON
Tuesday, October 29, 2013
Upgrade Wordpress Procedures
There is the official way to upgrade it manually, however, I am using the following methods to upgrade it
Backup wordpress
#Backup the database
#Backup the files
rsync -a wordpress/ wordpress.backup/
Download the latest wordpress
wget http://wordpress.org/latest.tar.gz
Extract the tar file
gunzip latest.tar.gz
tar -xvf latest.tar
this creates a wordpress directory
Disable all the plugins
Navigate to the admin panel and disable all the plugins
Copy the updated files
rsync -rtv new_wordpress/wordpress/ old_path/wordpress/
Check the website
Browse the website which usually prompts for the database upgrade.
If everything is OK, you can delete wordpress.backup/ folder
Saturday, September 28, 2013
Configuration File is not well-formed XML
It turns out that Exchange has corrupted the applicationHost.config file. If you try to open the file, you will see corrupted garbage characters all over the place.
Luckily I have got another Exchange 2013 server running on DAG, so I just copy the file applicationHost.config from C:\Windows\System32\inetsrv\config folder and replace the corrupted one then do IIS Reset
Saturday, September 07, 2013
OwnCloud - Setting IT Up
Setting it up is straight forward - just follow the doco. However, by default owncloud stores its file repository in the local server where owncloud is installed. I have a windows file share and I want all my files store in the windows file share
I am running Ubuntu and install owncloud in it.
I created a shared folder in my windows server, create a user account on my windows domain, straight forward.
on my Ubuntu server, firstly, I created a hidden file that contains the username and password of the windows domain account I created earlier
> vi /path/.smbcredentials
username=myuser
password=mypassword
save this file
next, I created a mount point to which I will mount the shared folder of my windows to this Ubuntu server
> mkdir /mount/projects
then I find the group id of the user account who is running the web server, in my case it is www-data
> id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
next, I edit the fstab file to mount the file share
> vi /etc/fstab
and add the following line:
//server.domain.local/share /mount/projects cifs credentials=/path/.smbcredentials,iocharset=utf8,sec=ntlm,dir_mode=0770,uid=33,gid=33 0 0
then do
> mount -a
it should mount the windows shared folder to /mount/projects
now, during owncloud installation, it will ask for the data folder, you can put /mount/projects !!
Monday, August 26, 2013
Pass 70-413 Exam
Monday, August 12, 2013
Micro$oft, what the.... ???
The IP 157.56.162.105 has just been banned by Fail2Ban after
6 attempts against ssh.
Here are more information about 157.56.162.105:
Lines containing IP:157.56.162.105 in /var/log/auth.log
Aug 11 20:40:08 x sshd[60929]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=157.56.162.105 user=root
Aug 11 20:40:10 x sshd[60929]: Failed password for root from 157.56.162.105 port 62640 ssh2
Aug 11 20:40:10 x sshd[60929]: Received disconnect from 157.56.162.105: 11: Bye Bye [preauth]
Aug 11 20:40:18 x sshd[60931]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=157.56.162.105 user=root
Aug 11 20:40:20 x sshd[60931]: Failed password for root from 157.56.162.105 port 1112 ssh2
Aug 11 20:40:20 x sshd[60931]: Connection closed by 157.56.162.105 [preauth]
Aug 11 20:50:17 x sshd[60935]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=157.56.162.105 user=root
Aug 11 20:50:18 x sshd[60935]: Failed password for root from 157.56.162.105 port 1064 ssh2
Aug 11 20:50:19 x sshd[60935]: Received disconnect from 157.56.162.105: 11: Bye Bye [preauth]
Aug 11 20:50:21 x sshd[60937]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=157.56.162.105 user=root
Aug 11 20:50:23 x sshd[60937]: Failed password for root from 157.56.162.105 port 62560 ssh2
Aug 11 20:50:23 x sshd[60937]: Received disconnect from 157.56.162.105: 11: Bye Bye [preauth]
Aug 11 20:50:29 x sshd[60939]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=157.56.162.105 user=root
Aug 11 20:50:31 x sshd[60939]: Failed password for root from 157.56.162.105 port 1184 ssh2
Aug 11 20:50:31 x sshd[60939]: Received disconnect from 157.56.162.105: 11: Bye Bye [preauth]
Aug 11 21:00:34 x sshd[60943]: Connection closed by 157.56.162.105 [preauth]
and guess who owns the 157.56.162.105?
Thursday, July 18, 2013
Securing SSH Server with fail2ban and Email Notification
https://help.ubuntu.com/community/Fail2ban
this helps me to ban the IP address and notify me by email of the failed attempt
and I use the following script to notify me by email of the successful login
edit or create /etc/sshd/sshrc
DATE=`date "+%d.%m.%Y--%Hh%Mm"`
IP=`echo $SSH_CONNECTION | awk '{print $1}'`
REVERSE=`dig -x $IP +short`
echo "Subject: SSH Login Successfully" > /tmp/mail.content echo "$DATE, user $USER just logged in from $IP ($REVERSE)" >> /tmp/mail.content
sendmail -f "MyBox <fromemail@domain.tld>" -t "Lau, Laurence <me@domain.tld>" -s smtprelay.domain.tld < /tmp/mail.content &
Saturday, June 08, 2013
MCSA 2012
Wednesday, June 05, 2013
SMTP TLS Authentication Testing
To test whether your SMTP support authentication, try the following
telnet your-smtp-server.domain.tld 25
Connected to your-smtp-server.domain.tld.
Escape character is '^]'.
220 your-smtp-server.domain.tld ESMTP
EHLO localhost
250-your-smtp-server.domain.tld
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Thursday, May 02, 2013
FreePBX Voicemail Drops Call With Error: lack of rtp activity in 31 seconds
It turns out the FreePBX detects there was no audio/RTP activity within 30 seconds (configurable) and drops the connection.
To change this: on your FreePBX, navigate to: Settings > Asterisk SIP Settings > Media and RTP Settings
Change the rtptimeout from 30 to 300, change rtpkeepalive from 0 to 30
Tuesday, April 30, 2013
Blackberry Device Service 10 SSL Certificate
So, in summary you need to do the followings:
- Backup BAS keystore
- Delete the default alias from keystore
- Generate a new key in keystore
- Generate CSR
- Submit CSR to your CA
- Import CA(s)
- Import public key for your SSL certificate
keytool -import -alias intermediateca -keystore "C:\Program Files (x86)\Research In Motion\BlackBerry Device Service\bas\bin\web.keystore" -file "C:\Temp\issuingca.cer"
Wednesday, April 17, 2013
Active Directory Domain Controller GPO Reset
Obviously the DCs have been joined to the domain and be put in the "Domain Controllers" OU by default after they were dcpromo-ed, which then got the old GPO applied to them.
So to clean them up all the registries, file systems security configuration that have been applied to DC, I need to reset the default domain policy and the default domain controllers policy. Before I do that, I back them up first, just in case.
To clean up the GPO run the following command:
C:\> DCGPOFIX
Then I need to clean up the actual settings that have been applied to my DCs by running the following command on each DC:
C:\> secedit /configure /cfg C:\windows\inf\defltdc.inf /db defltdc.sdb /overwrite
Reboot the DC
Thursday, April 04, 2013
Citrix StoreFront Authentication Check URL
https://storefront.domain.tld/Citrix/Authentication/Integrated/test.aspx
Sunday, March 31, 2013
FreePBX SIP Debugging
> asterisk -vvvvvr
localhost*CLI> sip show peers
it shows all your peers, then:
localhost*CLI> sip set debug peer (peer_name)
To stop debug, type:
localhost*CLI> sip set debug off
Tuesday, March 19, 2013
Manage Workgroup Servers with SCOM 2012
I have this task to have my Exchange Edge Transport server sitting on DMZ to be managed by SCOM
For them to be able to communicate and authenticate each other, they must be using a certificate.
I have my internal CA (lucky me)
1. Make sure your Workgroup server trusts your CA.
You can browse to your https://internal-ca.domain.com/certsrv URL and download the CA certificate and import this to the Workgroup server's Trusted Root CA (Computer store)
2. Make sure you have a certificate template that has Server and Client Authentication purposes
If you don't have one, duplicate one from the "Computer" template with Windows 2003 version. Make sure "allow export private key" is selected and "subject name" is supplied in the request.
3. Request a certificate from your Workgroup server to your internal CA
Use the template you created on step 2
4. Move certificate from user store to computer store
After request the certificate, it will automatically install the certificate on the user store. You need to export this (along with the private key) and import it back to the computer store
5. Install SCOM 2012 Agent
Insert SCOM installation ISO/DVD and install SCOM Agent. Make sure you are using FQDN for the SCOM server during the installation wizard
6. Firewall port need to be allowed on TCP 5723 inbound and outbound
SCOM Agent is using TCP 5723 port number to communicate with SCOM Server, open this on your firewall inbound and outbound
7. Import the certificate to SCOM Agent
On the installation ISO/DVD, navigate to SupportTools\AMD64 and run MOMCertImport.exe. It then asks you to select which certificate to use. Select the one that you created on step 3
8. Restart the System Center Management service
9. Request a certificate from your SCOM Management Server
Do exactly the same thing like step 3-4, but now do this from the SCOM Management Server
10. Import the certificate to SCOM Management Server
Do exactly the same thing like step 7-8, but now do this from the SCOM Management Server
11. Wait
Your agent should come out on the Pending Management section of your SCOM Administration console
Monday, March 04, 2013
VBScript Open Internet Explorer with No Address Bar
Dim objIENoToolbars
Set objIENoToolbars = WScript.CreateObject ("InternetExplorer.Application")
ObjIENoToolbars.Toolbar = false
objIENoToolbars.Navigate "http://mywebsite.domain.com/"
objIENoToolbars.Visible = true
Friday, February 01, 2013
Monday, January 21, 2013
Exchange 2010 SP2 RU 4v2 Bug - Mailbox Move
When you move the mailbox, it will have the Move Request Status: Completed with warning
You also will get the following comment:
Warning: Failed to clean up the source mailbox after the move.
Error details: MapiExceptionUnexpectedMailboxState: Unable to delete mailbox. (hr=0x80004005, ec=2634)
In the log of the move request, you will see the error:
Failed to clean up the source mailbox 'Primary (9105c233-5387-47bc-99ea-2c0255cf63ad)' after the move. Attempt 1/6.
Error details: MapiExceptionUnexpectedMailboxState MapiExceptionUnexpectedMailboxState: Unable to delete mailbox. (hr=0x80004005, ec=2634) at Microsoft.Mapi.MapiExceptionHelper.ThrowIfError(String message, Int32 hresult, SafeExInterfaceHandle iUnknown, Exception innerException)
at Microsoft.Mapi.ExRpcAdmin.DeletePrivateMailbox(Guid guidMdb, Guid guidMailbox, Int32 flags)
at Microsoft.Exchange.MailboxReplicationService.LocalMailbox.DeleteMailboxInternal(Int32 flags)
at Microsoft.Exchange.MailboxReplicationService.MailboxWrapper.<>c__DisplayClass2a.<Microsoft.Exchange.MailboxReplicationService.IMailbox.DeleteMailbox>b__29()
at Microsoft.Exchange.MailboxReplicationService.ExecutionContext.Execute(GenericCallDelegate operation)
at Microsoft.Exchange.MailboxReplicationService.MailboxWrapper.Microsoft.Exchange.MailboxReplicationService.IMailbox.DeleteMailbox(Int32 flags)
at Microsoft.Exchange.MailboxReplicationService.MoveBaseJob.<>c__DisplayClass6d.<PostMoveCleanupSourceMailbox>b__6b()
at Microsoft.Exchange.MailboxReplicationService.CommonUtils.CatchKnownExceptions(GenericCallDelegate del, FailureDelegate failureDelegate)
...
...
Post-move cleanup failed. The operation will try again in 30 seconds (5/6).
Failed to clean up the source mailbox 'Primary (9105c233-5387-47bc-99ea-2c0255cf63ad)' after the move. Attempt 6/6.
Error details: MapiExceptionUnexpectedMailboxState MapiExceptionUnexpectedMailboxState: Unable to delete mailbox. (hr=0x80004005, ec=2634)
at Microsoft.Mapi.MapiExceptionHelper.ThrowIfError(String message, Int32 hresult, SafeExInterfaceHandle iUnknown, Exception innerException)
at Microsoft.Mapi.ExRpcAdmin.DeletePrivateMailbox(Guid guidMdb, Guid guidMailbox, Int32 flags)
at Microsoft.Exchange.MailboxReplicationService.LocalMailbox.DeleteMailboxInternal(Int32 flags)
at Microsoft.Exchange.MailboxReplicationService.MailboxWrapper.<>c__DisplayClass2a.<Microsoft.Exchange.MailboxReplicationService.IMailbox.DeleteMailbox>b__29()
at Microsoft.Exchange.MailboxReplicationService.ExecutionContext.Execute(GenericCallDelegate operation)
at Microsoft.Exchange.MailboxReplicationService.MailboxWrapper.Microsoft.Exchange.MailboxReplicationService.IMailbox.DeleteMailbox(Int32 flags)
at Microsoft.Exchange.MailboxReplicationService.MoveBaseJob.<>c__DisplayClass6d.<PostMoveCleanupSourceMailbox>b__6b()
at Microsoft.Exchange.MailboxReplicationService.CommonUtils.CatchKnownExceptions(GenericCallDelegate del, FailureDelegate failureDelegate)
Request is complete.
The implication of this bug:
- There will be delay of 30 seconds x 6 tries = 3 minutes for each mailbox being moved
- During the last 3 minutes of the mailbox move, the Outlook client is being disconnected
- Mailbox in the source database is not deleted, it is mark as soft deleted mailbox
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -ne $null} | ft displayname,database,disconnectreason -auto
To delete the Soft Deleted mailboxes:
Remove-StoreMailbox -database "Old database" -Identity "Smith, John" -MailboxState SoftDeleted
So far there is no report from my users who have got their mailboxes moved
Tuesday, December 11, 2012
DNS IP to localhost
Surprisingly, Windows 7 rejects the setting when you put 127.0.0.1 as the DNS IP address of your network connection.
Found the following Powershell to change it easily
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"
$wmi.SetDNSServerSearchOrder("127.0.0.1")
Monday, November 05, 2012
SSRS SQL 2008 R2 Export Reports
Found this article by geektrainer.com how to create a VB script .rss file to exports all SQL Server Report file as an .rdl file.
Here is the code:
'must use -v rootPath="C:\Reports"
Sub Main()
Dim items As CatalogItem() = rs.ListChildren("/", true)
For Each item As CatalogItem in items
If item.Type = ItemTypeEnum.Folder Then
CreateDirectory(item.Path)
Else If item.Type = ItemTypeEnum.Report Then
SaveReport(item.Path)
End If
Next
End Sub
Sub CreateDirectory(path As String)
path = GetLocalPath(path)
System.IO.Directory.CreateDirectory(path)
End Sub
Sub SaveReport(reportName As String)
Dim reportDefinition As Byte()
Dim document As New System.Xml.XmlDocument()
reportDefinition = rs.GetReportDefinition(reportName)
Dim stream As New MemoryStream(reportDefinition)
document.Load(stream)
document.Save(GetLocalPath(reportName) + ".rdl")
End Sub
Function GetLocalPath(rsPath As String) As String
Return rootPath + rsPath.Replace("/", "\")
End Function
Save the code below as export.rss file, create a folder where the reports will be stored (e.g. C:\Reports) then run the RS.EXE command against your report server web service URL
rs.exe -i export.rss -s http://reportserver.domain.local/ReportServer -v rootPath="C:\Reports"
This will create all the reports in the .rdl format in the folder specified above
Monday, October 29, 2012
Windows Vault - SharePoint 2010
The reason for the prompt is that the username for unknown reason is wrong and cannot be changed!
If you check the security event log, you will see Event ID 4648
To fix this problem you need to check the Windows Credential Manager, start it from the CMD
control /name Microsoft.CredentialManager
and remove the wrongly assigned credential to the site
Friday, October 26, 2012
Cisco ASA on GNS3
I need a test lab for this. I use GNS3 for this.
I also need the ASA image and kernel files to be loaded in GNS3. Those files can be found from here
Once you got those files, you need to configure Qemu with the following options:
Qemu Options: -vnc none -vga none -m 1024 -icount auto -hdachs 980,16,32Kernel cmd line: -append ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536Also make sure you select the correct Initrd and Kernel files you downloaded earlier
You can now be able to start any ASA instance you have and when you do that, load the following keys:activation-key 0x4a3ec071 0x0d86fbf6 0x7cb1bc48 0x8b48b8b0 0xf317c0b5activation-key 0xb23bcf4a 0x1c713b4f 0x7d53bcbc 0xc4f8d09c 0x0e24c6b6
Wednesday, September 26, 2012
Cisco 4500 Series Switch Software Upgrade
Here are the steps to upgrade it:
- Copy the .bin file from the TFTP server to both Sups (Active and Standby)
- Change the boot system command
- Change the config register
- Reload the Standby Sup
- Failover the Sup
Sunday, August 05, 2012
App-V SQL Move Error 0000C800
http://technet.microsoft.com/en-us/library/gg252515.aspx
However, when trying to open the management console, I got the error code: 0000C800
One of the troubleshooting I have done was changing the UDL file and test connection was working, however the error persists.
It ended up I have to do the followings:
- Open the SftMgmt.udl file from the Notepad
- Copy the content of the file
- Rename the SftMgmt.udl file to SftMgmt.udl.old
- Create a new file using Notepad
- Paste the connection string to the newly created file and modify the connection string to use the new SQL name
- Save as the file to SftMgmt.udl
- DO NOT open this newly created file. Try to open the management console again, if that works, job is done!
Monday, July 16, 2012
SharePoint 2010 Version Number
(get-spfarm).buildversion
Tuesday, June 19, 2012
Friday, June 15, 2012
Exchange 2010 Distribution List Owner
This is by design. Exchange 2010 by default does not allow individual users to create, modify, remove and add members to distribution groups they own
The user will get access denied if they were trying to add/remove a user from the DL they were managing. To fix this, you can tick the check box from the RBAC User Editor/Default Role Assignment Policy. However as you can see in the description of this option, it will also grant the user to add and delete the DL by them self.
If we were only want to enable them to only manage the DL their own, you need to use the following PowerShell script:
# Script for creating a Role that can manage distributions groups but can't create new ones
#
#################################################################################
#
# The sample scripts are not supported under any Microsoft standard support
# program or service. The sample scripts are provided AS IS without warranty
# of any kind. Microsoft further disclaims all implied warranties including, without
# limitation, any implied warranties of merchantability or of fitness for a particular
# purpose. The entire risk arising out of the use or performance of the sample scripts
# and documentation remains with you. In no event shall Microsoft, its authors, or
# anyone else involved in the creation, production, or delivery of the scripts be liable
# for any damages whatsoever (including, without limitation, damages for loss of business
# profits, business interruption, loss of business information, or other pecuniary loss)
# arising out of the use of or inability to use the sample scripts or documentation,
# even if Microsoft has been advised of the possibility of such damages
#
#################################################################################
#
# Written by Matthew Byrd
# Matbyrd@microsoft.com
# Last Updated 10.15.09
# Parameter to get a different name than default for the new Role
Param([string]$name="MyDistributionGroupsManagement",[string]$policy="Default Role Assignment Policy",[switch]$creategroup,[switch]$removegroup)
# Help Function
Function Show-Help {
"
This script is will create or manage a management role designed to allow users to modify groups that they already own
but not create or remove any new distribution groups.
Switches:
-name Name of the managment role you want to create or modify
Defaults to: `"MyDistributionGroupsManagmenet`"
-policy Name of the Role Policy you want to assign the role to
Defaults to: `"Default Role Assignement Policy`"
-creategroup Adds or Removes the ability of the Role to Create DLs
-removegroup Adds or Removes the ability of the Role to Remove DLs
Examples:
--------------------------------------------
This will Use the default names and Policy and will create a role that cannot
Create or remove groups but can still modify them. If the role already exists
It will modify it by removing or adding the abiltity to create and remove groups
based on the current state.
Manage-GroupManagementRole -CreateGroup -RemoveGroup
"
}
# Function to modify a role by removing or adding Role Entries
# If no action is passed we assume remove
# $roleentry should be in the form Role\Roleentry e.g. MyRole\New-DistributionGroup
Function ModifyRole {
Param($roleenty,$action)
Switch ($action){
Add {Add-ManagementRoleEntry $roleenty -confirm:$false}
Remove {Remove-ManagementRoleEntry $roleenty -confirm:$false}
Default {Remove-ManagementRoleEntry $roleenty -confirm:$false}
}
}
If (($creategroup -eq $false) -and ($removegroup -eq $false)){
Show-Help
exit
}
# Test if we have a role that already has that name
If (([bool](Get-Managementrole $name -erroraction Silentlycontinue)) -eq $true){
Write-Warning "Found a Role with Name: $name"
Write-Warning "Trying to Modify Existing Role"
}
Else {
# Create the new Management Role
Write-Host "Creating Managmenet Role $name"
New-ManagementRole -name $name -parent MyDistributionGroups
}
# Determine if we have the New and Remove Role Entries on the Role Already
$create = [bool](Get-managementroleentry $name\New-DistributionGroup -erroraction Silentlycontinue)
$remove = [bool](Get-managementroleentry $name\Remove-DistributionGroup -erroraction Silentlycontinue)
# If we have the switch CreateGroup add or remove the RoleEntry for New-DistributionGroup
If ($creategroup -eq $true){
If ($create -eq $true){ModifyRole $name\New-DistributionGroup Remove;Write-Host "Removing ability to create distribution Groups from $name"}
elseif ($create -eq $false) {ModifyRole $name\New-DistributionGroup Add;Write-Host "Adding ability to create distribution Groups to $name"}
}
# If we have the switch RemoveGroup add or remove the RoleEntry for New-DistributionGroup
If ($removegroup -eq $true){
If ($remove -eq $true){ModifyRole $name\Remove-DistributionGroup Remove;Write-Host "Removing ability to create distribution Groups from $name"}
elseif ($remove -eq $false) {ModifyRole $name\Remove-DistributionGroup Add;Write-Host "Adding ability to create distribution Groups to $name"}
}
# Test if we have the assignment for the Role and Policy
# If we do ... write a warning
# If not create a new assignment
If (([bool](get-managementroleassignment $name-$policy -erroraction SilentlyContinue)) -eq $true){
Write-Warning "Found Existing Role Assignment: $name-$policy"
Write-Warning "Making no modifications to Role Assignments"
}
Else {
# Assign the Role to the Role Policy
Write-Host "Creating Managmenet Role Assignment $name-$policy"
New-ManagementRoleAssignment -name ($name + "-" + $policy) -role $name -policy $policy
}
Save the code to as MyDistributionGroupsManagement.ps1 file
Run the script:
MyDistributionGroupsManagement.ps1 -creategroup -removegroup
The script is basically create another role as a child role of the MyDistributionGroups and remove the ability to create and remove DL.
Once you have run the script, you will have the following Role:
Thanks to MS Exchange Team to share the script here
Wednesday, May 30, 2012
Netbackup Skipping Backup ID
no images were successfully processed (191)
and
found no images or media matching the selection criteria (190)
and if you do "Search Now" in the Catalog with Action: Verify, you will get the following error:
To fix this issue, run the following command:
bpexpdate -backupid XXXXX_1338296403 -d 0 -force
this will force the problematic backup id to expire
Monday, May 28, 2012
ESXi 5 Install Offline Bundle
- Download the ISO file from VMware
- Extract the ISO file and find the offline-bundle ZIP file
- SCP this ZIP file to the ESXi host (e.g. /tmp/driver.zip)
- Run the following command
esxcli software vib install -d /tmp/offline-bundle.zip
Reboot
Saturday, May 26, 2012
iPhoto Backup
#!/bin/bash mount -t smbfs //username:password@windowsserver/pictures /Users/laurence/Mount rsync -urz /Users/laurence/Pictures/iPhoto\ Library/Masters /Users/laurence/Mount/iPhoto umount /Users/laurence/Mount
Tuesday, May 22, 2012
Exchange ExMon
Exchange ExMon tool is an awesome tool! by using this tool, for each user session, you can view
- Number of packets
- Number of operations
- CPU Time
- CPU %
- Avg and Max Server latency
- Bytes In and Out
- Client Version and IP Address
- Read, PreRead and Dirtied Pages
- Log Bytes
The program can be downloaded from here
Sometime when you run it, it crashes :) and if you try to run it again, you will get the following error:
Then you should do the followings:
Open the Command Prompt and type in:
logman query -ets
As you can see in the picture above, the last line is: Exchange Event Trace
You need to stop this trace, by typing:
logman stop "Exchange Event Trace" -ets
Then you can run the ExMon again.
Monday, May 21, 2012
Exchange 2010 Recovery
CAS + Hub + UM Server Recovery
- Build the server, Windows 2008 R2 SP1, name it EXACTLY the same name with the failed server name
- Add all the Windows Server role + features required for CAS+Hub+UM
- Patch it
- Join to the domain
- Extract the Exchange 2010 SP2 to the temp directory (e.g. C:\temp)
- Run setup.com /m:RecoverServer
- Reboot and check the configuration
- Build the server, Windows 2008 R2 SP1 (Enterprise), name it EXACTLY the same name with the failed server
- Add the Windows Server role + features required for Mailbox role
- Patch it
- Join to the domain
- Remove the database copy from this failure Mailbox server (e.g. do this from the running Exchange 2010 Server)
Remove-MailboxDatabaseCopy DB1\MBX1
- Remove the failed server's configuration from the DAG
Remove-DatabaseAvailabilityGroupServer -Identity DAG1 -MailboxServer MBX1 -ConfigurationOnly
- Extract the Exchange 2010 SP2 to the temp directory (e.g. C:\temp)
- Run setup.com /m:RecoverServer
- Reboot
- Add the server back to the DAG
Add-DatabaseAvailabilityGroupServer -Identity DAG1 -MailboxServer MBX1
- Add the database copy
Add-MailboxDatabaseCopy -Identity DB1 -MailboxServer MBX1
Saturday, April 21, 2012
Trixbox + CUCM + Exchange UM + SP3102 + SRP527W Part 1
As you can see, there are a lot of SIP trunks between them. I will try to put the configuration for each of them
Exchange UM - CUCM
For Exchange UM and CUCM connection configuration, just follow the document published by Microsoft: http://www.microsoft.com/download/en/details.aspx?id=13591
The following is the CUCM Media Resource Group
The following is the CUCM Media Resource Group List
The following is the CUCM Configuration for the SIP Trunk to Exchange UM (e.g. mx01.domain.local), use the Media Resource Group List created above
CUCM - Trixbox
Create a new SIP Trunk Security Profile
Create a SIP trunk from CUCM to Trixbox, use the SIP Trunk Security Profile created above
Create a new Route Group
Create a new Route List
Create a new Route Pattern
I have extension 1499 and 1500 for Exchange UM Pilot and Auto Attendant respectively
I created a Route Pattern for default route to Trixbox when dial starts with 9. I also do exactly the same Route Pattern to the default route when dial starts with 0. The purpose for this is to use VOIP when dial with 9 and to use PSTN when dial with 0 first (configuration later on Trixbox)
Trixbox - CUCM
Thursday, April 12, 2012
NetScaler MAC Based Forwarding
You probably assign the NSIP on your Internal Network, MIP on your Intenal Network, SNIP and VIPs on your DMZ Network (for example for publishing CAG/SSL VPN). You then trying to access your NetScaler services from your Internal Network. This means your traffic from the Internal network goes to your default gateway (e.g. the firewall) which then forwarded to the VIP on DMZ Network. NetScaler then accept the traffic, however, the returning traffic will not going back to through the firewall (e.g. NetScaler default gateway), it will be going to the other NetScaler's NIC that connects to Internal network. This will create asymmetric routing, and most router/firewall will drop the packets.
To avoid this, usually enabling the MAC Based Forwarding (MBF) will fix this.
The following is the definition of MBF:
With MAC-based forwarding (MBF) enabled, when a request reaches the NetScaler appliance, the appliance remembers the source MAC address of the frame and uses it as the destination MAC address for the resulting replies. MAC-based forwarding can be used to avoid multiple-route/ARP lookups and to avoid asymmetrical packet flows. MAC-based forwarding may be required when the NetScaler is connected to multiple stateful devices, such as VPNs or firewalls, because it ensures that the return traffic is sent to the same device that the initial traffic came from.
To enable it, from the NetScaler Console:
Wednesday, April 11, 2012
XenServer 6.0 Kill Dead VM
To forcely kill that VM:
- Login to the XenServer console where the VM is hosted
- Get the VM Dom ID
xe vm-list name-label={VM Name} params=dom-id
- Get the list of live domains and see if the Domain ID of your VM is listed there
list_domains
- If your Domain ID VM is there, run the killing script
/opt/xensource/debug/destroy_domain -domid <dom id>
- Do another list_domain to check the Dom ID is gone
- Reset the power state of that VM
xe vm-reset-powerstate vm={VM Name} force=true
- If that still does not work do
xe-toolstack-restart
SharePoint 2010 - Get Logged In User Details
the SP.JS file should be available from the standard installation folder of SharePoint 2010
Sunday, April 08, 2012
FreeNAS 8 and Time Machine
Tricky bits settings up FreeNAS 8 on Hyper-V:
- Remove the default NIC when creating VM
- Add a new NIC, must be legacy NIC
- FreeNAS 8 does not recognize SCSI disks, only IDE
- After installed, change the IP to static
- do: ifconfig to find out the adapter name
- do: ifconfig
down - do: ifconfig
up
- Create a group called: backup-group
- Create a user called: backup-user, with primary group ID: backup-group, enter the password
- Go to Services, enable AFP
- Go to AFP Settings, make sure Local Access is ticked
- Go to Storage, and Create ZFS Data Set, called backup-apple
- Once it is created, edit its permissions, make sure owner-user is changed to backup-user and owner-group is changed to backup-group. Tick the option to have the Group the write access
- Go to Share, add Apple Share. Name it backup, path: /mnt/data/backup-apple. Make sure the Disk Discovery is ticked, Disk Discovery Mode is set to Time Machine.
- Click Go, and select Connect to Server
- Enter Server Address: afp://freenas-ip
- It will ask you for the username: backup-user, password: password
- Start Console, type:defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
- Start Time Machine and Select Disk, select the backup
Tuesday, April 03, 2012
Exchange 2010 SP2 Upgrade
- Login to Active Directory Server which holds schema master, as schema master and enterprise admin user, and run: setup.com /ps and setup.com /p
- Upgrade all the Hub/CAS
- Upgrade all the UM
- Upgrade all Mailbox Servers:
- Enable maintenance mode on the DAG of the server to be upgraded:
.\StartDagServerMaintenance.ps1 -server server1
- Upgrade to SP2
- Disable maintenance mode
.\StopDagServerMaintenance.ps1 -server server1
Thursday, March 08, 2012
Sharepoint 2007 Access User Profile
Download the latest jQuery SPServices JavaScript from here
Upload the JavaScript to your SharePoint site
Add a Content Editor Web Part to the page
Edit the Content Editor Web Part, include the following:
The userName and Email have got the value of the logged on user
Sunday, January 22, 2012
Passed Citrix XenServer 5.6 Exam
Tuesday, January 10, 2012
ESXi 4.1 NIC Driver Update
- Download the ISO file from VMware
- Extract the ISO file and find the offline-bundle ZIP file
- SCP this ZIP file to the ESXi host (e.g. /tmp/driver.zip)
- Run the following command
esxupdate –bundle=/tmp/driver.zip update
reboot
Friday, December 30, 2011
AppSense Upgrade from 8.0 to 8.1
SELECT [Name]
FROM [AppSensePersonalizationDB].[dbo].[User]
WHERE [DomainName] = 'DOMAIN'
Please note, my DB name is AppSensePersonalizationDB, yours probably has different name
Then save the result as a txt file, e.g. users.txt, which has entry like the following:
user1
user2
user3
You have to install AppSense EM Manager Tools to be able to use the EMPRegUtil. Once installed, create a batch file:
@echo off
SET EMPRegUtilConnectionString=Data Source=EMDB;Initial Catalog=AppSensePersonalizationDB;Integrated Security=SSPI
for /f "tokens=*" %%i IN (users.txt) DO call:doit %%i
:doit
if "%~1" == "" goto end
@echo %~1
@echo exporting MS Office 2010 Outlook profiles...
EMPRegUtil EXPORT DOMAIN\%~1 "Production" "MS Office 2010" "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook" C:\temp\%~1.reg
@echo deleting MS Office 2010 Outlook profiles...
EMPRegUtil DELETE DOMAIN\%~1 "Production" "MS Office 2010" "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem"
@echo deleting Session Data Outlook profiles...
EMPRegUtil DELETE DOMAIN\%~1 "Production" "Session Data" "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem"
@echo importing to Session Data Outlook profiles...
EMPRegUtil IMPORT DOMAIN\%~1 "Production" "Session Data" C:\temp\%~1.reg
:end
Please note:
my database server name is: EMDB
Run the batch script, it will export the Outlook profile from Managed application, delete the registry from managed application, delete the registry from session data and import the registry back to session data
Tuesday, November 15, 2011
Exchange 2007 Restore
Steps involved:
- Create the Recovery Storage Group
- Restore the Storage Group that has the database of the mailbox to be restored to the Recovery Storage Group
- Mount the database in that Recovery Storage Group
- Create an empty mailbox (AD User + Mailbox)
- Restore the mailbox to the new mailbox
Restore-Mailbox -RSGMailbox 'Doe, John' -RSGDatabase 'Recovery Storage Group\Mailbox Database 01' -id 'new mailbox' -TargetFolder 'myFolder'

