Categories
Exchange Server 2007

Exchange 2007 : Grant Full Mailbox Access via Shell

Exchange 2007 : Grant Full Mailbox Access via Shell

The following Exchange Management Shell command can be used to assign ‘Full Mailbox Access’ permissions on a users mailbox for another user:

Add-MailboxPermission “UserA” -User “UserB” -AccessRights FullAccess

This will grant UserB full access to UserA’s mailbox.

Categories
SQL

SQL : View Running Trace Information

SQL : View Running Trace Information

The following SQL can be used to identify any traces that are active on a SQL instance.

Use the query below to see how many running traces there are on the instance:

SELECT count(*) FROM :: fn_trace_getinfo(default) WHERE property = 5 and value = 1

running
1

The next query will return more detailed information about the active traces:

SELECT * FROM :: fn_trace_getinfo(default)

traceid property value
1 1 0
1 2 c:\temp\TraceGlobal
1 3 5
1 4 29:27.5
1 5

1

To halt the running trace use the fllowing query:

EXEC sp_trace_setstatus  1, @status = 0

To delete the trace definition from the database:

EXEC sp_trace_setstatus  1, @status = 2

 

Categories
Backups

VMWare VCB Troubleshooting ‘ non-zero return code’

VMWare VCB Troubleshooting ‘ non-zero return code’

I recently came across the following error when running a VCB via HP DataProtector 6.0:

 

“Creating a quiesced snapshot failed because the (user-supplied) custom pre-freeze script in the virtual machine exited with a non-zero return code”

The following steps resolved the issue:
  > Perform a ‘repair’ of the VMWare tools installed on the Virtual Machine
  > Restart the Virtual Machine

The error is generated because the VCB fails to execute a script on the VM due to an issue with the VMWare tools on the guest.

Categories
VBScript

VBScript : Find User SID

VBScript : Find User SID

Teh following script can be modified to return the SID of a user object. Change to be the hostname of a local DC, to be the sAMAccountNameof the user who’s SID you wish to find, and finally to be the NETBIOS name of the Active Directory domain:

strComputer = “
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)

Set objAccount = objWMIService.Get _
    (“Win32_UserAccount.Name=’‘,Domain=’‘”)
Wscript.Echo objAccount.SID

For example this could be changed to:

strComputer = “DC1
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)

Set objAccount = objWMIService.Get _
    (“Win32_UserAccount.Name=’BloggsJ‘,Domain=’MYDOMAIN‘”)
Wscript.Echo objAccount.SID

Categories
Performance

VMWare : Capturing Performance Statistics

VMWare : Capturing Performance Statistics

The following process will allow you to capture Windows Performance counter compatible CSV files from any ESX server using the ‘esxtop’ utility which is an integral part of VMWare ESX.

First we must create a couple of script files. The first being ‘ftp.sh‘ I have created the scripts on a datastore which houses NO Virtual Servers. Be careful where you place this data as filling up a datastore with VM’s will stop those VM’s working. You will need to modify the text in RED to ensure the script works in your environment. The text in RED is simply the path where the script fiels are located, and the path where the csv files will be generated.

This script will generate the CSV file and ‘trim’ it down to the stats we require. By default esxtop will generate an insanely large csv file. Once ‘trimmed’ it will upload the csv file to an FTP server of your choice and finally gzip/archive the file for future reference.

# Every 24 Hours FTP todays stats
#!/bin/bash
#
echo $(date +%R)
# Perform streamlining of CSV file
#
dm1=$(date –date=’1 day ago’ +%Y-%m-%d)
cat /vmfs/volumes/LOCAL_ATTACHED/esxtop/$HOSTNAME_$dm1.csv | cut -d “,” -f 1,`head -1 /vmfs/volumes/LOCAL_ATTACHED/esxtop/$HOSTNAME_$dm1.csv | tr “,” “\12” | egrep -n “\\\\\Memory\\\\\Free MBytes|Physical Disk\(vmhba1\)\\\\\Reads/sec|Physical Disk\(vmhba1\)\\\\\Writes/sec|Physical Disk\(vmhba1\)\\\\\MBytes Written|Physical Disk\(vmhba1\)\\\\\MBytes Read|\\\\\Physical Disk\(vmhba2\)\\\\\Reads/sec|Physical Disk\(vmhba2\)\\\\\Writes/sec|Physical Disk\(vmhba2\)\\\\\MBytes Written|Physical Disk\(vmhba2\)\\\\\MBytes Read |Physical Disk\(vmhba2\)\\\\\Commands/sec|Physical Disk\(vmhba1\)\\\\\Commands/sec|Physical Cpu\(_Total\)” | cut -d “:” -f 1 | tr “\12” “,”` > /vmfs/volumes/LOCAL_ATTACHED/esxtop/trim_$HOSTNAME_$dm1.csv

sed -i”.bak” “2d” /vmfs/volumes/LOCAL_ATTACHED/esxtop/trim_$HOSTNAME_$dm1.csv
rm /vmfs/volumes/LOCAL_ATTACHED/esxtop/trim_$HOSTNAME_$dm1.csv.bak -f
rm /vmfs/volumes/LOCAL_ATTACHED/esxtop/$HOSTNAME_$dm1.csv -f
mv /vmfs/volumes/LOCAL_ATTACHED/esxtop/trim_$HOSTNAME_$dm1.csv /vmfs/volumes/LOCAL_ATTACHED/esxtop/$HOSTNAME_$dm1.csv

HOST=’ftp.domain.local’
USER=’username’
PASS=’password’

# Connect to FTP Server
ftp -inv $HOST << EOF
user $USER $PASS
lcd /vmfs/volumes/LOCAL_ATTACHED/esxtop
put $HOSTNAME_$dm1.csv
bye
EOF

# GZIP and archive stats
#
gzip /vmfs/volumes/LOCAL_ATTACHED/esxtop/$HOSTNAME_$dm1.csv
mv /vmfs/volumes/LOCAL_ATTACHED/esxtop/$HOSTNAME_$dm1.csv.gz /vmfs/volumes/LOCAL_ATTACHED/esxtop/archive/


Secondly create the ‘capturestats.sh‘ script which will launch esxtop and capture the statistics you require. Again, modify the text in RED to suit you environment. This script will capture stats every 60 seconds 1439 times – there are 1440 minutes in a day, and we want the script to start again at midbight, so thisscript will run 00:00 to 23:59.

# capture.sh
#!/bin/bash
#
today=$(date +%Y-%m-%d)
#
# There are 1440 minutes in a day, we want to capture 00:00 > 23:59 so we’ll specify 1439 captures at 60 second intervals.
#
esxtop >>
/vmfs/volumes/LOCAL_ATTACHED/esxtop/EUVMTST1_$today.csv -d 60 -n 1439 -c /root/.esxhoststats

Next, create the esxtop config file under /root/.esxhoststats. This will ensure that we capyure only what we need, CPU stats, Memory Useage and Disk I/O stats. You can modify your own config file to meet your own requirements.

abcdefgh
abcdefghijklmno
AbcdefghIjklm
abcdefghijk
abcdefghijk
ABcDEFGHIJKLm
5u

Finally, under root acount context (accessed via sudo su –) execute the ‘controb -e‘ command. Add the following lines to the file:

#!/bin/bash
00 00 * * * /vmfs/volumes/LOCAL_ATTACHED/esxtop/capturestats.sh >/dev/null
00 01 * * * /vmfs/volumes/LOCAL_ATTACHED/esxtop/ftp.sh >/dev/null

 This will cause the capturestats.sh script to run at midnight every day and the ftp.sh script to run at 01:00 everyday.

Categories
SQL

SQL : Enable AWE on i386/x86

SQL 2000 : Enabling AWE on Windows Server

On an x86/i386 system it is possible to use PAE and AWE to allow SQL to use more than 2GB of RAM. Windows Server Advanced 2000 x86 allows for up to 8GB of RAM using PAE and AWE, Windows Server 2003 Enterprise allows for up to 16GB.Datacenter editions allow for even greater ammounts of PAE/AWE assigned RAM.

First configure the /PAE switch in the operating system boot.ini file. You can also use the /3GB switch if not configuring more than 16GB of RAM.

Next, run the following SQL to enabled the instance to use AWE, and therefore the newly available RAM.

sp_configure ‘show advanced options’, 1
RECONFIGURE
GO
sp_configure ‘awe enabled’, 1
RECONFIGURE
GO
sp_configure ‘max server memory’, 2048 — This Sets The Allocation To 2 Gigabyte
RECONFIGURE
GO
 

You will have to restart the SQL instance for the change to become effective.

Considerations:

  • The total sum of all SQL assignd RAM should not be greater than all of the memory in the server; you should removed 2GB from this total for the OS if not using the /3GB  switch, or 1GB if using the /3GB switch.
  • You should configure the SQL service account to have ‘Lock Pages In Memory‘ permissions; this will prevent the AWE memory being paged to disk.
  • On a failover cluster environment, the sum of ALL instance assigned AWE memory should be no greater than the total memory (taking the kernel reserved 2GB/1GB depending on /3GB switch) on a single node. If this is exceeded, any instance which starts on a node where all memory is assigned will start in dynamic mode with 128MB RAM, or my even fail to start.
  • The ‘min server memory’ option is ignored when using AWE.
  • You cannot monitor SQL server memory use when utilising AWE from Task Manager – this will simply show the SQL instance using the total amount of memory. The following SQL can be used to identify real memory usage:

select counter_name,cntr_value/1024 As MemoryUsedMB from master..sysperfinfo
where counter_name = ‘Total Server Memory (KB)’

  • AWE is is an enabler allowing a 32-bit Operating System to address more than 4GB of physical memory.; there are obvious benifits however, there are performance considerations which should not be over looked when using AWE. For example, AWE memory cannot be swapped to the page file, therefore you should closely monitor application memory requirements after machine startup before allocating memory to SQL.
Categories
Windows Server 2003

HP BL460 : ASR hpqilo2 Issues

HP BL460 Automatic System Reboot Errors

For a while now a set of HP BL460c servers have been randomly rebooting, the HP Integrated Management Log shows ‘ASR Detected by System ROM‘ along with the following events in the System event log on an affected machine:

Event Type:    Warning
Event Source:    hpqilo2
Event Category:    None
Event ID:    57
Failed GET SENSOR READING, sensor 16

Event Type:    Warning
Event Source:    hpqilo2
Event Category:    None
Event ID:    57
NetFN 0x4, command 0x2D timed out

The solution for this was to perform the following:

  • Install the latest ILO Firmware Update v. 1.81
  • Install the HP iLO Management Channel Interface Driver v. 1.15.0.0
  • Install the HP ProLiant iLO2 Management Controller Driver  v. 1.12.0.0

All of these drivers can be downloaded form the following location, selecting your operating system:

http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=3288156?=en&cc=us&prodTypeId=3709945&prodSeriesId=1842750&taskId=135

Categories
Domain Migration

Windows 2008 : DCPromo Administrator Account Error

Windows 2008 : DCPromo Administrator Account Error

When trying to promote a Windows Server 2006 x84 R2 server to a domain controller of a new forest I obtained the following error which stopped the promotion of the system:

The local Administrator account becomes the domain Administrator account when you create a new domain. The new domain cannot be created because the local Administrator account password does not meet requirements.

Currently, a password is not required for the local Administrator account. We recommend that you use the net user command-line tool with the /passwordreg:yes option to require a password for this account before you create the new domain; otherwise, a password will not be required for the domain Administrator account.

To resolve this error, open a command-prompt as Administrator and execute the following command: net user Administrator /passwordreq:yes *

This will ensure that the Administrator account requires a password, and that a password is set. After running this I was able to proceed with the promotion of the server to a DOmain Controller.

 

Categories
Windows Server 2003

EFS : Manging EFS in a Domain

Troubleshooting EFS Certificates

EFS is an incredibly powerful security tool for todays security minded business, it can also be an incredible pain to troubleshoot.Here are some useful commands and processes ot identify why EFS may not be performing as expected.

1) Check that the certificate is in the users profile; EFS is dependant upon the users profile containing the EFS certificate. The profile is used when accessingencrypted shares over the network.

2) This may be down to a CRL access issue. Verify certificate services is running on the CA: certutil -ping -config

3) Obtain file EFS information from the encrypted file, will obtain the hash of the certificate in use. Use the following command whitin the shared folder to get the hash of the certificate used to encrypt the file: efsutil /c

4) Obtain certificate information, using the hash obtained in step 3: certutil -store -v -user MY “”

5) Check the following Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\EFS\CurrentKeys . Ensure that the Default EFS Hash is correct, if not delete the value – it will auto-recreate.

Categories
VBScript

vbScript : Disable Windows Search Install

Outlook 2007 : Disable Windows Search Install Prompt

The Windows Desktop Search functionality can slow down Microsoft Outlook 2007, as well as a users entire workstation. The following machine startup script will disable prompts for users to install this plug-in normally gernerated by Microsoft Outlook.

‘Script to Disable Windows Search For Outlook 2007
Const ForReading = 1
Const ForWriting = 2
Const HKEY_CURRENT_USER  = &H80000001

Set WshShell = CreateObject(“WScript.Shell”)
Set fso = CreateObject(“Scripting.FileSystemObject”)
windir = WshShell.ExpandEnvironmentStrings(“%windir%”)

Set objNetwork = CreateObject(“Wscript.Network”)
currentDomain = objNetwork.UserDomain
currentUser = objNetwork.UserName

‘Disable Windows Desktop Search Prompts
InstallDIR = WshShell.ExpandEnvironmentStrings(“%PROGRAMFILES%”) & “\Microsoft Office\Office12”
target = InstallDIR & “\OUTLOOK.exe”
If fso.FileExists(target) Then    ‘If there is no Outlook 2007 executable install Outlook 2007    
    Set objNetwork = CreateObject(“Wscript.Network”)
    Set wmiLocator = CreateObject(“WbemScripting.SWbemLocator”) ‘ Object used to get StdRegProv Namespace
    Set wmiNameSpace = wmiLocator.ConnectServer(objNetwork.ComputerName, “root\default”) ‘ Registry Provider (StdRegProv) lives in root\default namespace.
    Set objRegistry = wmiNameSpace.Get(“StdRegProv”)
    objRegistry.SetDWORDValue HKEY_CURRENT_USER,”Software\Microsoft\Office\12.0\Outlook\Search”,”DisableDownloadSearchPrompt”,1
End If