Thursday, June 09, 2005

Rightfax 9 Dialing Rules Export

How to export Rightfax 9 Dialing Rules from SQL into a CSV file.

I was unable to use any of the GUI's in Rightfax 9 to export the dialing rules database as since SP1, they have moved them to SQL tables.

Using SQL Manager, there are 3 tables I need as far as I can see.

dbo.DTDiallingRules : holds a list of every rule with unique Rule ID's
dbo.DTConfigurationDaillingRules : holds server GUID's plus associated Rule ID's
dbo.DTConfigurations : maps server name to server GUID's.

So it should be a matter of creating a DSN in ODBC manager to your SQL server, then exporting the 3 tables, cross referencing and job done. And so faxrules.vbs was born.

'==============================================
'
' VBScript Source File
'
' NAME: FaxRules.vbs
'
' AUTHOR: Woosie.
' DATE : 08-06-2005
'
' COMMENT: Export Rules on a daily basis to keep tabs on things.
'
'==============================================

Dim DTDR,DTCDR,DTC

' -------------------------
' Create Connection to ODBC
' -------------------------
' These lines may need changing.
DSN="rightFAXDSN"
uid="sa"
pwd="xxxxxxxx"

FullPath="c:\"
todays=FormatDateTime(Date,1)
Dim MyTime,MyHour,Myminute
MyTime=now
Myhour=hour(mytime)
myminute=minute(mytime)
times=myhour & "-" & myminute
FullPath=FullPath & "\" & todays & ".csv"
Set fso = CreateObject("Scripting.FileSystemObject")
Set objfile = fso.OpenTextFile(fullpath, 8, True)

Dim OBJdbConnection
Set OBJdbConnection = CreateObject("ADODB.Connection")
Set RS = CreateObject ("ADODB.Recordset")
Set SQLStmt = CreateObject("ADODB.Command")

' -------------------------
' Open Connection
' -------------------------
OBJdbConnection.ConnectionString = "dsn=" & DSN &";uid=" & uid & ";pwd=" & pwd &";DATABASE=RightFax;APP=ASP Script"
OBJdbConnection.Open

set rsDTCDR=createobject("adodb.recordset")
RSDTCDR.open "DTConfigurationsDialingRules",OBJdbConnection,3,3
objfile.writeline("Server,RuleID,SourceServer,Pattern,DestinationServer,Protocol,PriorityDelta,

Flags,PriorityMask,StartChannel,TimeofDayMask_0,TimeofDayMask_1,
TimeofDayMask_2,
TimeofDayMask_3,TimeofDayMask_4,TimeofDayMask_5,TimeofDayMask_6,
BeginDelete,BeginReplace,EndDelete,EndReplace,UserID,GroupID,EndChannel,
Comment,MinQueueDepth,ExtraWeight,DelayHour,
FaxSize,MLAccount,MLPassCode,MLDocAccount,DNDNotifyList,NotifySender")
DTCDR=rsDTCDR.GetRows()
DTCC=UBound(DTCDR,1)
DTCR=UBound(DTCDR,2)
For lo1=0 To DTCR
Rule=DTCDR(1,lo1)
Disabled=DTCDR(2,lo1)
If disabled = 0 Then
objfile.writeline(GUID2Server(DTCDR(0,lo1)) & ",Disabled")
Else
objfile.writeline(GUID2Server(DTCDR(0,lo1)) & "," & RuleID(rule))
End if
next
Set rsDTDR=Nothing
Set rsDTCDR=Nothing
Set rsDTTC=Nothing
Set objfile=Nothing


Function GUID2Server(target)
' -------------------------
' Return Servername from GUID
' -------------------------
set rsDTC=createobject("adodb.recordset")
RSDTC.open "DTConfigurations",OBJdbConnection,3,3
GUID2Server="Not Found"
DTC=rsDTC.GetRows()
DTCC1=UBound(DTC,1)
DTCR1=UBound(DTC,2)
For loGUID=0 To DTCR1
If target=DTC(0,loGUID) Then
GUID2Server=DTC(1,loGUID)
End if
Next
Set rsDTC=Nothing
End Function

Function RuleID(target)
set rsDTDR=createobject("adodb.recordset")
RSDTDR.open "DTDialingRules",OBJdbConnection,3,3
RuleID="Not Found"
DTC=rsDTDR.GetRows()
DTCC2=UBound(DTC,1)
DTCR2=UBound(DTC,2)
For loGUID=0 To DTCR2
If target=DTC(0,loGUID) Then
RuleID=""
For add=0 To DTCC2
RuleID=RuleID & chr(34) & DTC(add,loGUID) & Chr(34) & ","
Next
End If
Next
Set rsDTDR=Nothing
End Function

Friday, May 06, 2005

KB883543 breaks OWA in Exchange 2003 UPDATE

Good news at last. Micrsoft have released a fix to KB883543 which caused the rule not to be able to saved.. Apparantly,

This problem occurs because OWA rules ignore address type information that is enclosed in brackets. For example, OWA rules would ignore the following string:[AddressType:E-mail]
Download the hotfix from the KB article, KB875269.

Monday, April 04, 2005

KB883543 breaks OWA in Exchange 2003...

If you have applied KB883543 onto your Exchange 2003 box, you will find that any rule you try to create in OWA that tries to forward to another user will now bring up the dialog box.

This rule cannot be saved. Wait a few minutes and try again. If the problem persists, contact your administrator.

The only option at the moment is to uninstall this hotfix which restore functionality...

I don't believe, at time of posting, there is a fix for this hotfix..

Nice..

Thursday, March 17, 2005

Exchange 2003 SP1 Registry Updates.

It transpires when you install E2k3 SP1 onto a server, the reg key

HKLM\SOFTWARE\Microsft\Updates\Exchange Server 2003\SP1 and subfolders is deleted to be replaced by

HKLM\SOFTWARE\Microsft\Updates\Exchange Server 2003\SP2

SP1 also removes the $ExchUnintstall directories in c:\winnt

Strange as that removes all trails of what hotfixes you did have installed Pre-SP1..

A pain for me as we have to audit old Hotfixes to ensure they were installed..

Tuesday, March 08, 2005

HP / Compaq Rib board detector

Get asked a lot if a server the other side of the world has a rib board installed..


This little script lets me know.


' Rib board detector.
' Scans list of servers for rib boards
' (c) 2005 Woosie


const HKEY_LOCAL_MACHINE = &H80000002
Const ForReading = 1, ForWriting = 2
Dim fso, MyFile, FileNam
Dim strComputer,TheLeft,TheDoctor
Set StdOut = WScript.StdOut
FileNam=InputBox ("Enter Target Server for RIB Board detection ?")
strcomputer = FileNam
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_
strComputer & "rootdefault:StdRegProv")
strKeyPath = "SYSTEMCurrentControlSetEnumRootLEGACY_CPQRIB000"
strValueName ="DeviceDesc"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
IF LEN(strValue)>4 then
msg=MsgBox("Rib board installed on " & strComputer)
else
msg=MsgBox("No rib board installed on " & strComputer)
end if

How do I query a domain local group ?

How do I query a domain local group ? Suppose you are in Domain A and are member of a domain local group in Domain B. The Domain A DC does not know about it, nor does the GC. Only the Domain B DC knows about it. I finally came up with this solution. It is slow though as it has to query the AD tree..


'==========================================================================
'
' NAME: DomainLocalGroup.vbs
'
' AUTHOR: Woosie
' DATE : 02-03-2005
'
' COMMENT: Scan AD Tree looking for local group membership and then output
' list to screen.
'
'==========================================================================


Dim localgroups()
localgroup=0
struser = InputBox("User to assess local group membership (e.g. cn=bennnett_s) ?","Local Group Scanner")
' change next line to point to your root AD path.
Set oDomain = GetObject("[link]")
WScript.Echo("Searching Domain a.. Please wait..")
EnumOU(oDomain)


WScript.Echo (struser & " is a member of : ")
For myloop=0 To localgroup
WScript.Echo(localgroups(myloop))
next
Wscript.Quit


Function EnumOU(oContainer)
For Each oObj In oContainer
For Each sClass in oObj.ObjectClass
If LCase(sClass) = "organizationalunit" Then
WScript.echo "Searching " & oObj.AdsPath
EnumOU(oObj)
Else
If LCase(sclass) = "group" Then
WScript.Echo oobj.name & " " & oObj.AdsPAth
strPath =oObj.AdsPAth
set objGroup = GetObject(strPath)
for each objMember In objGroup.Members
splitme=split(objMember.Get("distinguishedname"),",")
if lcase(splitme(0))=lcase(struser) Then
localgroup=localgroup+1
ReDim Preserve localgroups(localgroup)
localgroups(localgroup-1)=strpath
Wscript.Echo struser & " is a member of local group : " & strpath
End if
Next
End If
End If
Next
Next
End Function