Monday, October 11, 2010

Enable telnet in Windows 7

Needed a telnet session from my windows7 a couple of times in the past 6 months. Up until today i gave up downloading a third part application for that purpose, and turned on a VPC image with an XP os.

Then by coincident i needed a windows feature and found that both telnet client and server i just disabled in windows7 by default. Propably due to the security issues attached to telnet (always ssh whenever you can). But i need telnet from time to time.

Here is how you do:

  1. Go to control panel
  2. Go to "Turn windows features on or off"
  3. Go to "Telnet client" and set the checkmark in the box
That's it.


Sunday, October 10, 2010

User can't log in to outlook for some users

Experienced that outlook failed to log on to the exchange server for 2 users on a terminal server (2008 server).
All other users were working perfect.
Tried to change the chemney settings of the exchange server's nic settings by running this command: Netsh int ip set chimney DISABLED 
Found at this link . No success.

Resolution was to move the users profile folder, in this case c:\users\FOLDER, to a temporary location in order to preserve any user files and settings. Delete the 2 profiles that did not work, and let the users log on to the terminal server via RDP.
After the new profile was created, Outlook logged perfectly on to the exchange server again.

Still don't know what caused the error.

Sunday, September 12, 2010

Good old 3.0 - And looking at 2011

I have been working at a customer for the past 2 weeks integrating sharepoint and activating the marketing features of 3.0. Doing scripting, customizations and development of custom forms, reminds me of how important fundamental understanding of the application and the possabilities of customizations are to work efficient.

The knowledge build up on working for the past 3 years at 4.0, reading blog posts and books, has made lots of decissions more easy in relation to 3.0.

AND - now i have been doing some tests on 2011 (former known as crm 5.0). And the posibilities here are basically the same.... but with quite some nice features (objects) made available, that i was looking for in vain in 4.0.
So we are allmost there.
I have to point out, that the challange in getting the most out of Microsoft Dynamics CRM is to know what you can do and what you can't. That is a combination of the functional and technical skills of the team defining the final solution.
Sure step is aiming at having the correct project team on both the customer and the supplier side. But only few implementation projects are in a scale that permit a project organization to cover all the ressources.
And that will leave the mid- and small sized installations in the same condition as today....... Coping with lack of functionality caused be the limitations found at first glance. Due to lack of knowlodge from the project team members. On both customer and supplier side.
So awareness, product training, in depth customization and development training is a must.
Fortunately the people that have been working with CRM since 3.0 can bring forward the knowledge they gained in the past, and reuse -invent features and solutions in 2011.

Tuesday, June 1, 2010

Audit for all tables in sql database

I recently came across this post: http://weblogs.asp.net/jgalloway/archive/2008/01/27/adding-simple-trigger-based-auditing-to-your-sql-server-database.aspx


I use it for tracing SSIS packages to verify the updates, deletions and inserts are done as intended.
I did some minor modifications due to some missing spaces in the original post.
This does have an impact on huge databases with huge tables, so please bare in mind that you need to disable og simply delete the triggers, when you are done with the Audit.


the script:



USE TheDatabaseIWannaUse
GO


IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 'Audit')
CREATE TABLE Audit
(
AuditID [int]IDENTITY(1,1) NOT NULL,
Type char(1), 
TableName varchar(128), 
PrimaryKeyField varchar(1000), 
PrimaryKeyValue varchar(1000), 
FieldName varchar(128), 
OldValue varchar(1000), 
NewValue varchar(1000), 
UpdateDate datetime DEFAULT (GetDate()), 
UserName varchar(128)
)
GO


DECLARE @sql varchar(8000), @TABLE_NAME sysname
SET NOCOUNT ON


SELECT @TABLE_NAME = MIN(TABLE_NAME) 
FROM INFORMATION_SCHEMA.Tables 
WHERE 
TABLE_TYPE = 'BASE TABLE' 
AND TABLE_NAME != 'sysdiagrams'
AND TABLE_NAME != 'Audit'


WHILE @TABLE_NAME IS NOT NULL
 BEGIN
EXEC('IF OBJECT_ID (''' + @TABLE_NAME+ '_ChangeTracking'', ''TR'') IS NOT NULL DROP TRIGGER ' + @TABLE_NAME+ '_ChangeTracking')
SELECT @sql = 
'
create trigger ' + @TABLE_NAME+ '_ChangeTracking on ' + @TABLE_NAME+ ' for insert, update, delete
as


declare @bit int ,
@field int ,
@maxfield int ,
@char int ,
@fieldname varchar(128) ,
@TableName varchar(128) ,
@PKCols varchar(1000) ,
@sql varchar(2000), 
@UpdateDate varchar(21) ,
@UserName varchar(128) ,
@Type char(1) ,
@PKFieldSelect varchar(1000),
@PKValueSelect varchar(1000)


select @TableName = ''' + @TABLE_NAME+ '''


-- date and user
select @UserName = system_user ,
@UpdateDate = convert(varchar(8), getdate(), 112) + '' '' + convert(varchar(12), getdate(), 114)


-- Action
if exists (select * from inserted)
if exists (select * from deleted)
select @Type = ''U''
else
select @Type = ''I''
else
select @Type = ''D''


-- get list of columns
select * into #ins from inserted
select * into #del from deleted


-- Get primary key columns for full outer join
select @PKCols = coalesce(@PKCols + '' and'', '' on'') + '' i.'' + c.COLUMN_NAME + '' = d.'' + c.COLUMN_NAME
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS pk ,
INFORMATION_SCHEMA.KEY_COLUMN_USAGE c
where pk.TABLE_NAME = @TableName
and CONSTRAINT_TYPE = ''PRIMARY KEY''
and c.TABLE_NAME = pk.TABLE_NAME
and c.CONSTRAINT_NAME = pk.CONSTRAINT_NAME


-- Get primary key fields select for insert
select @PKFieldSelect = coalesce(@PKFieldSelect+''+'','''') + '''''''' + COLUMN_NAME + '''''''' 
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS pk ,
INFORMATION_SCHEMA.KEY_COLUMN_USAGE c
where pk.TABLE_NAME = @TableName
and CONSTRAINT_TYPE = ''PRIMARY KEY''
and c.TABLE_NAME = pk.TABLE_NAME
and c.CONSTRAINT_NAME = pk.CONSTRAINT_NAME


select @PKValueSelect = coalesce(@PKValueSelect+''+'','''') + ''convert(varchar(100), coalesce(i.'' + COLUMN_NAME + '',d.'' + COLUMN_NAME + ''))''
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS pk ,    
INFORMATION_SCHEMA.KEY_COLUMN_USAGE c   
where  pk.TABLE_NAME = @TableName   
and CONSTRAINT_TYPE = ''PRIMARY KEY''   
and c.TABLE_NAME = pk.TABLE_NAME   
and c.CONSTRAINT_NAME = pk.CONSTRAINT_NAME 


if @PKCols is null
begin
raiserror(''no PK on table %s'', 16, -1, @TableName)
return
end


select @field = 0, @maxfield = max(ORDINAL_POSITION) from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = @TableName
while @field < @maxfield
begin
select @field = min(ORDINAL_POSITION) from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = @TableName and ORDINAL_POSITION > @field
select @bit = (@field - 1 )% 8 + 1
select @bit = power(2,@bit - 1)
select @char = ((@field - 1) / 8) + 1
if substring(COLUMNS_UPDATED(),@char, 1) & @bit > 0 or @Type in (''I'',''D'')
begin
select @fieldname = COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = @TableName and ORDINAL_POSITION = @field
select @sql = ''insert Audit (Type, TableName, PrimaryKeyField, PrimaryKeyValue, FieldName, OldValue, NewValue, UpdateDate, UserName)''
select @sql = @sql + '' select '''''' + @Type + ''''''''
select @sql = @sql + '','''''' + @TableName + ''''''''
select @sql = @sql + '','' + @PKFieldSelect
select @sql = @sql + '','' + @PKValueSelect
select @sql = @sql + '','''''' + @fieldname + ''''''''
select @sql = @sql + '',convert(varchar(1000),d.'' + @fieldname + '')''
select @sql = @sql + '',convert(varchar(1000),i.'' + @fieldname + '')''
select @sql = @sql + '','''''' + @UpdateDate + ''''''''
select @sql = @sql + '','''''' + @UserName + ''''''''
select @sql = @sql + '' from #ins i full outer join #del d''
select @sql = @sql + @PKCols
select @sql = @sql + '' where i.'' + @fieldname + '' <> d.'' + @fieldname 
select @sql = @sql + '' or (i.'' + @fieldname + '' is null and  d.'' + @fieldname + '' is not null)'' 
select @sql = @sql + '' or (i.'' + @fieldname + '' is not null and  d.'' + @fieldname + '' is null)'' 
exec (@sql)
end
end
'
SELECT @sql
EXEC(@sql)
SELECT @TABLE_NAME= MIN(TABLE_NAME) FROM INFORMATION_SCHEMA.Tables 
WHERE TABLE_NAME> @TABLE_NAME
AND TABLE_TYPE= 'BASE TABLE' 
AND TABLE_NAME!= 'sysdiagrams'
AND TABLE_NAME!= 'Audit'
END

Thursday, March 4, 2010

Go Offline with Microsoft Dynamics CRM 4.0

At a customer, one of their clients couldn't go offline.
After some digging I discovered that the Local Data Group Setup was taking all Accounts. The clients that worked going offline only had a few accounts and none of these accounts had any error. After the Local Data Group on these records were set to all accounts they failed too.
So as the error said that the lenght of customeraddress1 was too long, I looked at the field in both the local SQL Express on the client and on the crm's sql database. On entity Address attribute Address1 was 50 on client and 150 on server SQL.
So i changed the lenght on the client. Look below to see how i found my way through the lenght of attributes.
Still didn't work. Now the error was more generel. Customeraddress couldn't be imported.
I forgot to check for additional attributes that mismatched the lenght in both crm server and client.
Changed postbox and everything worked.

Now, how can this error occur?

The installation on client was a Microsoft Dynamics CRM 4.0 for Outlook with offline capability.
I installed it from www.microsoft.com/downloads with the version where UR7 is included. After successful installation i installed UR9 on top of that, because that was on the server.

I would expect both database schemas to be in sync when the CRM team released new versions to both servers and clients (and srs and data migration manager and email router). But apparently the test before release does not cover all the possible combinations of clients, ur's and servers. Hope that will be better in the future.

To check the schemas for the server and client databases follow the guides from this blog: http://blogs.msdn.com/jannemattila/archive/2008/02/13/comparing-two-databases-schema-and-or-data.aspx

Wednesday, January 13, 2010

SBS2008: Exchange 2007 stops receiving mails due to low disk space

Resolution
Move queue and queue transaction logs to another disk drive. Description here.


The path to find the answer
First i noticed that mails stopped comming in. Users were complaining about phonecalls from mailsenders that received an administrative mail saying that mails could not be delievered to the address of the exchange server. A quick look discovered lack of disk space. Though this Small Business Server 2008 did have a 60GB partition for the OS.
So then cleaning up the WSUS to only include updates from the actual OS on the clients (aprx. 30 client computers). Then using the cleanup tool (options/cleanup from WSUS server console) freed up 2 GB, wich was enough to let the server receive e-mails again.
Well, a few days later the error occured again. No mails received.
So i digged into the folder sizes using a small console app i build, just to get a list of folder sizes in 2.nd level of folder hierachi. Found winsxs and lost my breath.
Nearly 20GB of assembly files..... Windows side by side are reffered to many places, but it seems as moving the winsxs is not an option.
Back to business: noticed that it the mail stopped comming in when the size was less then 1.5GB. Odd. 'Cause no services stopped. BUT the queues for the Edge Transport didn't have enought space to receive further mails and messages for processing.
So searching for "move queue exchange 2007" came up with the result in the beginning of this post.