Wednesday, November 08, 2006
SQL Browser account
Since SQL Browser is a service listening to unauthenticated UDP messages, the goal was to make the service running account as restrictive as possible. This has been documented in the BOL: http://msdn2.microsoft.com/en-us/library/ms181087.aspx
Tuesday, October 17, 2006
This How To guide describes the process of relocating the MIIS 2003 database, named MicrosoftIdentityIntergrationServer from a computer that is running Microsoft® SQL Server™ 2000 to another computer that is running SQL Server 2000 with all critical data intact. Specifically, you will perform the following tasks:
• Stop the MIIS service, backup the MIIS 2003 encryption key and MIIS 2003 database.
• Restore the MIIS 2003 database to another server hosting Microsoft SQL Server 2000 Enterprise Edition.
• Uninstall and reinstall MIIS 2003 to point to the new server hosting the MIIS 2003 database.
More:
http://technet2.microsoft.com/WindowsServer/en/library/244b15d1-6363-42f0-b853-a62591b3fb021033.mspx?mfr=true
Tuesday, October 03, 2006
Options are:
1. Create a new web site that can be used for the non ADFS enabled sites
2. Install WSS which will install to the default web site. Create a second web site and configure the second site as a WSS site in sharepoint central administration. Now uninstall WSS from the default web site. At this point you can install other ADFS as well non ADFS enabled apps to the default web site.
Is the object always deleted from the metaverse when the last connector is disconnected (even if I am using ShouldDeleteFromMV to explicitly say leave object in the metaverse even if the last connector has disconnected)?
Yes, it is. A MV object requires a connector as justification for its existence. The sync engine removes automatically all MV objects without a connector. This is independent from the configuration of the object deletion rule.
How to monitor https traffic? Is there any IE plug-in available?
Look into:
http://www.ieinspector.com/httpanalyzer/index.html
www.parosproxy.org
http://www.fiddlertool.com
Is there a way to export MIIS flow errors to file to have a closer look?
You can use CSExport, there is a parameter to only export objects that show an error, '/:fe. CSExport is in the bin directory under the MIIS install folder. So if you ran 'CSExport AD ADErrors.log /f:e' from that directory, it should create XML file that only shows errors. Of course you would need to further parse this if you were interested in only the DNs.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mmsdev/mms/hologram_xml.asp
Tuesday, September 19, 2006
Good starting point could be, sample scripts for managing Active Directory organizational units:
http://www.microsoft.com/technet/scriptcenter/scripts/ad/ous/default.mspx?mfr=true
when you try to access a Web site that is part of an IIS 6.0 application pool
This behavior may occur if the following conditions are true:• The IIS 6.0 Web site is part of an IIS application pool. • The application pool is running under a local account or under a domain user account. • The Web site is configured to use Integrated Windows authentication only. In this scenario, when Integrated Windows authentication tries to use Kerberos, Kerberos authentication may not work. To use Kerberos authentication, a service must register its service principal name (SPN) under the account in the Active Directory directory service that the service is running under. By default, Active Directory registers the network basic input/output system (NetBIOS) computer name. Active Directory also permits the Network Service or the Local System account to use Kerberos.
More: http://support.microsoft.com/kb/871179/en-us
Monday, August 28, 2006
After you install SQL Server 2005, the Setup program creates several entries in the Currently installed programs list in Add or Remove Programs. The Microsoft SQL Server 2005 entry is a starting point to add or remove components of SQL Server 2005. However, you should be aware of certain differences in using the Add or Remove Programs item for stand-alone installations and for clustered installations of SQL Server 2005.
More at: http://support.microsoft.com/?kbid=922670
Monday, July 31, 2006
I am just looking to return a bool if the text file has been modified. I am not trying to determine what data has been changed.
If you want to continuously poll your file for modifications, then FileSystemWatcher would be of help.
http://msdn2.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
From http://support.microsoft.com/default.aspx?scid=kb;en-us;889834:
The DateTimePicker and MonthCalendar control do not reflect the CurrentUICulture property of an application's main execution thread when you created a localized application in the .NET Framework, in Visual Studio 2005, or in Visual Studio .NET
There seems to be more detail at http://blogs.msdn.com/michkap/archive/2005/03/28/402839.aspx and http://blogs.msdn.com/michkap/archive/2005/10/27/485462.aspx
Wednesday, May 24, 2006
On the Tools menu, click Import ant Export Settings
Select Reset all settings
Click Next, Select Yes or No on the next page according to your preference
Click Next, Select Visual C# Development Settings
Click Finish
I want all the files located in a folder (folder name known & names of the files not known) to be copied to another location?
DirectoryInfo di = new DirectoryInfo(“foldername_with_complete_path”);
FileInfo[] fiList = di.GetFiles();
foreach(FileInfo fi in fiList)
{
File.Copy(fi, “NewDirName” + “\\” + fi.Name);
}
One of my services I am developing is depending on WMI. I am using WMI notifications and hardware enumeration. When my computer gets restarted my service loads up in a wrong order. It seems like my service is started before the WMI Service. Does anyone know how I can control the load order of my service?
Look into "ServiceInstaller.ServicesDependedOn" option at
http://msdn2.microsoft.com/en-us/system.serviceprocess.serviceinstaller.servicesdependedon.aspx
Wednesday, May 10, 2006
How to recover a deleted folder (shift+delete) from Outlook InBox.
246153 XCLN: How to Recover Items That Have Been Hard Deleted
http://support.microsoft.com/?id=246153
I guess this is set by default with OL2003. If deleted items are not being preserved on the Exchange server, you've got nothing.
I’ve written a media player and need to copy the window while in pause mode. 6 pack of fav beverage for solution.
Google is full of Pinvoke ([DllImport) samples, I’d prefer a GDI+ .net solution.
If you are using CLR 2.0, you can avoid PInvoke by using the Graphics::CopyFromScreen method.
http://msdn2.microsoft.com/en-us/library/system.drawing.graphics.copyfromscreen.aspx
When using terminal services client to connect to a server, how can you change the background?
On the machine with TS, go into TS Configuration, select Server Settings and Enable Active Desktop
I want users to download my content to their client computer rather than simply viewing it in the browser. But how do you override the browser's determination to render known MIME types itself?
Suppose you've written an ASP page that contains a link to a known MIME type, but you want the user to download the file instead of viewing it. Add the following to your script:
response.addHeader "content-disposition", "attachment;filename=filename.ext"
Then substitute the actual filename and extension, and it's as good as done.
Monday, April 24, 2006
Using this library and the following code you can grant permissions to user for a folder share programmatically.
SecurityDescriptor desc = SecurityDescriptor.GetNamedSecurityInfo (
shareHandle,
SE_OBJECT_TYPE.SE_LMSHARE,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
Dacl dacl = null;
if (desc == null)
{
desc = new SecurityDescriptor();
desc.AllocateAndInitializeSecurityDescriptor();
dacl = new Dacl();
}
else
{
dacl = desc.Dacl;
}
dacl.AddAce (new AceAccessAllowed (new Sid ("BUILTIN\\Administrators"), AccessType.GENERIC_ALL));
dacl.AddAce (new AceAccessAllowed (new Sid ("Everyone"),
AccessType.GENERIC_READ
AccessType.GENERIC_EXECUTE
AccessType.READ_CONTROL
AccessType.STANDARD_RIGHTS_READ));
desc.SetDacl(dacl);
desc.SetNamedSecurityInfo(faxShare,
SE_OBJECT_TYPE.SE_LMSHARE ,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
However, ASP.NET 2.0, a security enhancement was made so that changes to values in ReadOnly or Disabled TextBoxes are ignored; the original value, stored in ViewState is presented on the server.
What is a valid work-around for this situation?
We added the HTML attribute “ReadOnly” to the TextBox manually, using code like:
TextBox1.Attributes.Add("ReadOnly", "true");
This ended up working: it appears that the browser respects the HTML tag, and ASP.NET is tricked into thinking the control is not read only. Is this the best workaround, or is there a better hook?
In ASP.NET 2.0 when you are using ReadOnly property, user can’t enter anything in textbox by any wayTo restrict user entry you should use:
TextBox1.Attributes.Add("contentEditable", "false");
We are using Forms Authentication.It was working fine for us until we started using a load balancer with three IIS boxes. We are not setting an encryption key anywhere. We are using the encryption provided by ASP.NET 2.0 We are getting the following exception now. I believe it is failing when consecutive requests are going to different IIS boxes and the different IIS boxes are not sharing an encryption key. Any idea?
Good start to resolve this would be: How To: Configure MachineKey in ASP.NET 2.0
More: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000007.asp
ASP.NET version 2.0 continues to offer managed data access using ADO.NET and managed classes for XML. But ASP.NET 2.0 also includes new features to make data access in Web pages easier to implement and manage.More: http://msdn2.microsoft.com/en-us/library/06t2w7da(VS.80).aspx
The Visual Studio 2005 Web Application Project Model
This is a new web project option for Visual Studio 2005 that provides the same conceptual web project approach as VS 2003 (a project file based structure where all code in the project is compiled into a single assembly) but with all the new features of VS 2005 (refactoring, class diagrams, test development, generics, etc) and ASP.NET 2.0 (master pages, data controls, membership/login, role management, Web Parts, personalization, site navigation, themes, etc). More: http://www.asp.net/webproject
Abortable thread pools
I want to share an excellent article on Abortable thread pools in March 2006 edition of MSDN mag.
http://msdn.microsoft.com/msdnmag/issues/06/03/NETMatters/
Tuesday, March 21, 2006
SQL Server 2005 introduces DDL Triggers
-- Example of DDL Trigger @ Database Level:
CREATE TRIGGER safety
ON DATABASE
FOR DROP_TABLE, ALTER_TABLE
AS
PRINT 'You must disable Trigger "safety" to drop or alter tables!'
ROLLBACK ;
In the next example, a DDL trigger prints a message if any CREATE LOGIN, ALTER LOGIN, or DROP LOGIN event occurs on the current server instance. It uses the EVENTDATA function to retrieve the text of the corresponding Transact-SQL statement.
-- Example of DDL Trigger @ Server Level:
CREATE TRIGGER ddl_trig_login
ON ALL SERVER
FOR DDL_LOGIN_EVENTS
AS
PRINT 'Login Event Issued.'
SELECT EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(max)')
GO
DROP TRIGGER ddl_trig_login
ON ALL SERVER
GO
Thursday, March 16, 2006
SQL 2005 - SQLCMD command-line tool
- Database build scripts where you need to pass values specific to a certain environment. - Hot fixes and patches.
- Any scenario where use of stored procedures (with it’s built-in parameters) is not an option and you must rely on a SQL script.
In this example SQLCMDTest.SQL [NOTE: That you must delimit character strings with a single quote]
declare @DaysToAdd datetime,
@MyString varchar(32)
SELECT @DaysToAdd =$(daystoAdd),
@MyString='$(mystring)'
SELECT GETDATE()+@DaysToAdd,
@MyString
Then, you call the SQL Script passing in the values as:
SQLCMD -b -w4000 -l10 -E -i"SQLCMDTest.sql" -v daystoAdd="10" -v mystring="CeltoGrass"
SQL 2005 - Share Job Schedule
Consider the following example:
User1 creates a job called "Job1" with a schedule called "Schedule1". Since he was told only to run jobs starting at the time defined in Schedule1 by the product team, User1 wants to create his second job, called Job2, with this same schedule.
The simplest to do this would be from SQL Server Management Studio by clicking on the job schedule properties and selecting the "Pick" button which will allow him to select the schedules from the listed job. This would also allow User1 to view all the other jobs that has same schedule. He would be able to see only those jobs that were created by him unless he is a system administrator.
Monday, March 13, 2006
-- Example:
Create view v_test with SCHEMABINDING as
Select c1,c2 from dbo.t_test where c2 = '01/01/1980'
go
Create unique clustered index idx_v_test on v_test(c1)
go
-- Result:Cannot create index on view 'db_test.dbo.v_test' because the view uses an implicit
-- conversion from string to datetime or smalldatetime. Use an explicit CONVERT with a
-- deterministic style value.
-- Solution: You can use explicit conversion specifying style value for example:
Create view v_test with SCHEMABINDING as
Select c1,c2 from dbo.t_test where c2 = convert(datetime,'01/01/1980',120)
go
-- In this case string will be converted to datetime input as yyyy-mm-dd hh:mi:ss (24h).
Create unique clustered index idx_v_test on v_test(c1)
go
--Result:Command(s)
-- completed successfully.
Example:
1. You give User1 Control permission on an object with GRANT OPTION;
2. User1 give User2 Control permission on the object;
3. You REVOKE Control permission on the object from User1 with CASCADE option.
4. User2 still have Control permission on the object.
Grant Control on T to usr1 WITH GRANT OPTION
go
Execute as user = 'usr1'
go
Grant Control on T to usr2
go
REVERT
go
Revoke Control on T from usr1 Cascade
go
-- Usr2 still has control permission on T. To be able to revoke control permission from all users
-- who's been given this permission by User1.
-- User1 should be specified explicitly when granting permission to User2:
Grant Control on T to usr2 AS usr1
go
SQL 2005 - OUTPUT clause with DML
Example: Let's change the address from the address table to the reverse of the original value.
--Create the address table
Create Table Address (ProductID Int, SupplierID Int, Address Varchar(255))
--Insert data
Insert into Address Values (234,567,'1234 One SQL Way, Microsoft City, U.S.')
Insert into Address Values (345,678,'1234 One Windows Way, Microsoft City, WA')
--Declare a table variable
Declare @Recordchanges table (change Varchar(255))
--Update the address
Update Supplier.Address Set Address=reverse(address)
--Record the updates into the table variable
OUTPUT 'Original Value:' + DELETED.Address+' has been changed to: '+ INSERTED.Address+'' into @RecordChanges
--Query the changes from table variable
Select * from @RecordChanges
--Result-set
------------------------
Original Value:'1234 One SQL Way, City, U.S.' has been changed to: '.S.U ,ytiC,yaW LQS enO 4321'
Original Value:'1234 One Windows Way, City, WA' has been changed to: 'AW ,ytiC ,yaW swodniW enO 4321'
Query Notification in SQL 2005
MSDN Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/querynotification.asp