cb-net.co.uk

...WinTel Admin Simplified

  • Increase font size
  • Default font size
  • Decrease font size

SQL : Find Current Database Name

E-mail Print PDF

SQL : Find Current Database Name

The following T-SQL will identify the name of the current Database and set the variable @dbname to the name of the database.

/* Establish Current Database Context */
declare @dbname varchar (200)
set @dbname = (SELECT DB_NAME())

This is useful when checking the existence of a table within the current database, for example:

IF object_id(@dbname +N'..tblFragStats') IS NULL
    BEGIN
        CREATE TABLE tblFragStats (
           Date DATETIME, ObjectName CHAR (255), ObjectId INT,
           IndexName CHAR (255), IndexId INT,
           Lvl INT, CountPages INT,
           CountRows INT, MinRecSize INT,
           MaxRecSize INT, AvgRecSize INT,
           ForRecCount INT, Extents INT,
           ExtentSwitches INT, AvgFreeBytes INT,
           AvgPageDensity INT, ScanDensity DECIMAL,
           BestCount INT, ActualCount INT,
           LogicalFrag DECIMAL, ExtentFrag DECIMAL
            )
    END

This code will function on any version of Microsoft SQL, from 2000 SP4 onwards.

 

VBScript : Find Windows Hardware Architecture

E-mail Print PDF

VBScript : Find Windows Hardware Architecture

The following VBscript will establish whether the local system is x86 or x64 and enable you to execute further commands based upon this. Simply copy the code into a new .vbs file and add the additional steps within the if statement.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    & strComputer & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery _
    ("SELECT Architecture FROM Win32_Processor")

For Each objProcessor In colSettings
    If objProcessor.Architecture = 9 Then
    '64 bit OS
    ElseIf objProcessor.Architecture = 0 Then
    '32 bit OS
    End If
Next

 

Exchange 2007 : Error: The Exchange server address list service failed to respond

E-mail Print PDF

Exchange 2007 :  Error: The Exchange server address list service failed to respond

During a DR simulation I recently came across the following error on an Exchange 2007 CCR cluster:



Error: The Exchange server address list service failed to respond. This could be because of an address list or email address policy configuration error.

The issue was that the System Attendandt Service had lost connection to the domain controller to which it was using. For some reason it did not automatically onnect to another DC. All other Exchange Functions were working, but management of users, groups and system objects was impossible.

To resolve this issue simply restart the Exchange System Attendant Instance service for the cluster using the Cluster Administrator tool.

This will allow the service to re-attch to an available Domain Controller.

Last Updated on Monday, 09 November 2009 22:41
 

Citrix : The RPC server cannot be contacted on server .

E-mail Print PDF

Citrix : The RPC server cannot be contacted on server .

This issue has plague me infrequently over the last 3 - 6 months - a Citrix server in a PS4.5 farm would suddenly be unable to use the Citrix Access Management Console as when the discovery process was running it would report:

 The RPC server cannot be contacted on server .

The solution for this is simple. If the IMA Service has been restarted or terminated unexpectantly the Citrix COM+ components will sometimes fail to refresh. To resolve this perform te follwoing steps:

  • Terminate 'ConfigMgrSvc.exe' using Task Manager
  • Re-open the Citrix Access Management Console and Run Discovery.

 Further information is availabke here: http://support.citrix.com/article/CTX116752

 

Exchange 2007 OWA Access To Other Users Mailboxes

E-mail Print PDF
Granting Mailbox Access to Other Users Mailbox via OWA

OWA will does not work with inherited mailbox database/server permissions for other users mailbox access. Permissions must be specifically granted on each mailbox. The Powershell scripts will enable access to users users mailboxes ia OWA for a chosen user or group.
 

Save the the following powershell script to a bew .ps1 file, modifying the appropriate username/group name as highlighted in red.
# Set-Full Mailbox Permissions on all Mailboxes in Org for EU Mailbox Admins
#
#This is required for OWA mailbox access as OWA does not support inherited permissions on mailboxes
#
Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyContinue
$userAccounts = get-mailbox -resultsize unlimited
ForEach ($user in $userAccounts)
{
add-MailboxPermission -identity $user -user “Exchange Mailbox Admins” -AccessRights FullAccess
}

Alternately you can grant access to all mailboxes from OWA for a single Mailbopx Database using the following script, change the mailbox database path as applicable for your environment:
# Set-Full Mailbox Permissions on all Mailboxes in Org for EU Mailbox Admins
#
#This is required for OWA mailbox access as OWA does not support inherited permissions on mailboxes
#

Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyContinue
$userAccounts = get-mailbox -resultsize unlimited -Database "MYSERVER\SG2\Mailbox Database"
ForEach ($user in $userAccounts)
{
add-MailboxPermission -identity $user -user “Exchange Mailbox Admins” -AccessRights FullAccess
}
 


Page 5 of 6