Travis's profileTravis Lingenfelder's Bl...BlogLists Tools Help

Travis Lingenfelder's Blog

Travis

Occupation
Location
Interests
I'm a senior consultant for Catapult Systems, a Microsoft National Systems Integrator (NSI), headquartered in Austin, Texas.

Custom HTML

May 05

New Blog Location

The company I work for, Catapult Systems, has recently given me a place where I can do external blogging about work related topics.  Therefore, technical blog post from here on out will be located on this new blog.  Any personal posts will stay here.

New Blog Location:  http://blogs.catapultsystems.com/tlingenfelder

March 25

Create a Linked Server to an Oracle DB from Server 2008 and SQL 2008

We recently needed to create a linked server from Microsoft SQL Server 2008 to an Oracle 9.0.1 database on a Windows Server 2008 x64 server. For your reference, here is an outline of the steps used to successfully create the linked server connection. When trying to establish the linked server in SQL Management Studio the Oracle OLE Provider would never seem to work successfully. Instead, we used ODBC with a System DSN to create the connection and this seemed to work reliably and the overhead of the DSN and slight performance hit were acceptable in our case.

Download and Install the Oracle Client

1) Download the Oracle Database 10g Client Release 2 (10.2.0.4) from http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10204_winx64_vista_win2k8.html.

2) Unzip the archive and run setup.exe in the client folder.

3) When prompted for the installation type, choose Administrator (InstantClient did not work).

Configure the Service Name
I got the steps for this section from Sid Atkinson’s Blog at: http://www.sidatkinson.com/post/2007/09/27/One-way-to-create-a-linked-Server.aspx

4) Upon completion of the install the Net Configuration Assistant should automatically launch. If it does not, you can run it from Start à All Programs à Oracle – OraClient10g_homeX à Configuration and Migration Tools à Net Configuration Assistant.

5) In the Select naming methods dialog, select the default – Local Naming and click Next.

6) When prompted for a service name, enter the desired service name.

7) Choose the protocol, most likely TCP and click Next.

8) Enter the host name or IP address – we used the IP address, and enter the port information. When ready, click Next.

9) I recommend that you perform a test, by selecting Yes, perform a test and click Next. If credentials are needed a change Login button will be presented after Next is clicked.

10) When prompted for the net service name just click Next.

11) Keep clicking Next until you get to the configuration complete screen and then click Finish.

Create an ODBC System DSN

12) Open the Start menu and navigate to All Programs à Oracle – OraClient10g_homeX à Configuration and Migration Tools à Microsoft ODBC Administrator.

13) Select the System DSN tab.

14) Click the Add… button.

15) Select the driver that has the name of the Oracle instance in which you installed earlier, this will be something likeOracle in OraClient10g_homeX and click Finish.

16) Enter a Data Source Name for your new system DSN.

17) Select the TNS Service name that you entered in step 6 above.

18) Click the Test Connection button and enter credentials as necessary.

Establish the Linked Server

19) Open SQL Management Studio and log into the database engine for the instance you want to establish a linked server.

20) In the Object Explorer, expand the Server Objects Node, then right-click Linked Servers and select New Linked Server …

21) On the General tab, create a meaningful name for the linked server in the Linked server prompt.

22) Make sure the radio button for Other data source is selected and in the provider drop-down, select Microsoft OLE DB Provider for OBDC Drivers – *NOT* Oracle Provider for OLE DB, I could not get this to work and it would often cause SSMS to freeze just by selecting it.

23) Enter something like Oracle for the Product name.

24) In the Data source box enter the name of the System DSN that you gave in step 16 above.

25) On the left, select the Security link.

26) Configure your security configuration – in our case we selected the option for Be made using this security context and entered the credentials so that all connections used the same credential.

27) On the Server Options page, the only change that was made was Collation Compatible was set to True.

28) Click Ok and the new linked server should be configured.

February 27

PowerShell Script to Set the SharePoint Diagnostic Log Path and Retention

Overview

PowerShell script that will move the SharePoint log files and set the retention of the log files.

To run this script you will need to set the PowerShell execution policy using the following PowerShell command:

set-executionpolicy Unrestricted

Copy the following code and paste it into a PowerShell script file like SetSPLog.ps1. To call this from the command line or within a command script file use the following syntax:

This will move the log files to D:\Logs\SharePoint, keeping 96 files that have 30 minutes of logs in each file.

powershell.exe "& SetSPLog.ps1 'D:\Logs\SharePoint' 96 30"

Code

if ($args.length -lt 3) {write-warning "Syntax: SetSPLog.ps1 [Location] [Logs to Keep] [Log Interval]"; break}

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$diaglog=[Microsoft.SharePoint.Administration.SPDiagnosticsService]::Local
$diaglog.LogLocation=$args[0]
$diaglog.LogsToKeep=$args[1]
$diaglog.LogCutInterval=$args[2]
$diaglog.Update()

PowerShell Read configuration file into a HashTable

This PowerShell snippet will read the contents of an .ini style settings file into a HashTable.

Example Setting.txt

[General]
MySetting1=value

[Locations]
InputFile="C:\Users.txt"
OutputFile="C:\output.log"

[Other]
WaitForTime=20
VerboseLogging=True

PowerShell Command

Get-Content "C:\settings.txt" | foreach-object -begin {$h=@{}} -process { $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) { $h.Add($k[0], $k[1]) } }

*The above statement may be broken into multiple lines for web display only.

After executing the code snippet, a variable ($h) will contain the values in a HashTable.

Name                           Value
----                           -----
MySetting1                     value
VerboseLogging                 True
WaitForTime                    20
OutputFile                     "C:\output.log"
InputFile                      "C:\Users.txt"

To get an item from the table use the command $h.Get_Item("MySetting1").

April 16

Visual Studio Add-in to get an assemblies PublicKeyToken

Often times during the course of a development project you may want to easily obtain the PublicKeyToken used to sign the assembly. Most people will add the assembly to the GAC and then use the properties dialog to copy out the information needed to register the assembly with its complete signature. This is especially true for modifying the web.config when doing any type of web or SharePoint development.

Follow the steps in this post to create a Visual Studio add-in tool that will show you the PublicKeyToken directly from Visual Studio.

  1. In Visual Studio, select External Tools from the Tools menu.
  2. In the External Tools dialog, click Add and enter Get Assembly Public Key for the Title.
  3. Fill the Command textbox by browsing to sn.exe. It is typically installed at the following location: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe.
  4. In the Arguments textbox, type the following (case sensitive) -Tp "$(TargetPath)".
  5. Enable the Use Output window checkbox.
  6. Click OK. The new command is added to the Tools menu.

After building the assembly, select Get Assembly Public Key from the Tools menu in Visual Studio and the PublicKeyToken will be displayed Visual Studio's output window.

October 24

The SharePoint:CssLink and SharePoint:CssRegistration Server Controls

The SharePoint:CssLink and SharePoint:CssRegistration controls work together in order to inject the various CSS style sheet references on a page. The SharePoint:CssLink server control must reside on the master page while the SharePoint:CssRegistration server controls may be placed on a master page, page layout, or content page where appropriate. When the page is assembled, all of the CssRegistrations from the various components that are brought together to build the page are rendered by the SharePoint:CssLink server control.

When using CSS, the order in which the style sheets are placed on the page determine what styles will override others from the varying style sheets. The style sheet that is placed last – deemed more relevant – is the one currently registered as the Alternate CSS URL for the site. Immediately above it is a reference to the core.css. If it is a publishing site, the HtmlEditorTableFormats.css and the HtmlEditorCustomStyles.css are placed above the core and any style sheets registered with the SharePoint:CssRegistration control are placed at the top of the list.

October 22

Location Aware Content Query Web Part for use in Page Layouts

The Content Query Web Part (CQWP) is a useful tool for displaying data within a site. If you want to use the CQWP in a Page Layout to rollup information relative to the current location you have to perform some manual configuration. After creating the page, you would have to tell the CQWP where to get its data from. Wouldn't it be nice though to create the page using the desired page layout with a CQWP already added and it automatically knew the location in the site hierarchy. This may be easier than you think.

To accomplish this you would create what I call the Location Aware Content Query Web Part. Basically, create a new Web Part that inherits from the Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, then, override the CreateChildControls method and add two lines of code.

First, create a new Visual Studio project using the SharePoint Web Part project template.

lacqwp3.png

Add a reference to Microsoft.SharePoint.Publishing.dll to the project.

image001.png

Now, let's add our code.

lacqwp2.png

Notice that by default, the SharePoint Web Part template uses the Render method. I removed this from the file and replaced it with an overridden RenderWebPart method that in turn calls the RenderWebPart method of the base class. The main addition in functionality is done by overriding the CreateChildControls method. In this method we use the SPContext class to determine the current site within the hierarchy and pass the AbsolutePath property of the Uri class to the WebUrl property of the web part.

We now have a new Content Query Web Part that is aware of its location within the site hierarchy. We can now include this as part of a page layout. When a page is created from the page layout, the web part would automatically be aware of its location and display the desired content using the style specified in the page layout.

March 30

Business Desktop Deployment –Microsoft’s *New* Deployment Methodology

You may have heard about a new "product" from Microsoft called the Business Desktop Deployment (BDD) 2007. Although the BDD is a downloadable item from the Microsoft Download Center, it is not just a deployment technology; it is actually a best-practice methodology. The true BDD "product" is a set of proven practices and technologies structured around the Microsoft Solutions Framework (MSF).

Technologies Involved

The DBB brings together the following practices and technologies to provide a consistent, repeatable deployment solution.

  • Windows Vista Business, Enterprise, and Ultimate
  • Windows XP Professional with Service Pack 2
  • Office Professional, Professional Plus, Enterprise, and Ultimate 2007
  • Office Professional Edition 2003
  • Systems Management Server 2003 R2
  • Operations Manager 2005
  • Windows Automated Installation Kit
  • Windows Pre-installation Environment 2.0
  • Windows Deployment Services
  • Application Compatibility Toolkit 5.0
  • Deployment Workbench
  • User State Migration Toolkit 3.0
  • Enterprise Learning Framework

Process Integration

The BDD provides an approach that defines the people, processes, and technologies to facilitate a successful deployment solution. Using the guidelines defined in BDD 2007 you can manage deployment project teams, testing environments, hardware/software inventory, imaging, security, and automation.

Solution Areas

Using the guidance in the BDD helps IT organizations to accomplish the following areas:

  • Application Compatibility – Discover and mitigate application compatibility issues before it impacts the business.
  • Computer Imaging – Use standard baselines that include core applications, operating systems, and company requirements to standardize the IT environment.
  • Infrastructure Management – Tools used to inventory and understand the IT environment, as well as, mitigation of problems and changes.
  • Deployment – Involves getting the product into first, a testing environment and ultimately into the production IT environment.
  • Application Management – The process of packaging and automating application deployment via the disk image or post-operating system deployment mechanisms.
  • User State Migration – Reducing the impact to users by retaining their profiles and data throughout the deployment process.
  • Security – Beginning with a secure baseline deployment is crucial to maintaining the health of the IT environment.

BDD Components

  • Plan, Build, and Deploy Guide – An MSF driven project guide that outlines the overall planning and management content used for project planning, timelines, teams, and roles.
  • Feature Team Guides – A series of guides, each around a specific technical area that will help individual project teams: understand the underlying concepts, perform step-by-step processes, and understand project deliverables.
  • Job Aids – Templates and customizable starting points used throughout the project.
  • Solution Technology – The application, servers, scripts and other tools used in implementing deployment projects.

BDD Solution Types

Lite-Touch Installation – The Lite-Touch Installation scenario minimizes deployment pains, but requires at least a minimal amount of interation.

 

Zero-Touch Installation – Larger network infrastructures that employ the use of Systems Management Server (SMS) and Microsoft Operations Manager (MOM) 2005 have the ability to completely deploy software without the aid of any IT personnel.

More to Come

If you are interested in the BDD and deployment, check back over the next few weeks. I'm putting together a series of posts, guides, and tools that you may find extremely useful in providing end-to-end solutions using the BDD.

Useful Links

TechNet Desktop Deployment TechCenter - http://www.microsoft.com/technet/desktopdeployment/default.mspx

Microsoft Solution Accelerator for Business Desktop Deployment 2007 - http://www.microsoft.com/technet/desktopdeployment/bdd/2007/default.mspx?WT.mc_id=bddfr

March 21

Relocating the InetPub hive

Many people believe that it is not possible to relocate the IIS file system hive located at C:\InetPub. Well, this is not true. As a matter of fact, it is very easy to specify the location of the InetPub folder to any drive and path that you want. This does have to be performed when you install Internet Information Services (IIS) to the machine. If IIS is already installed, you will have to remove it.

I personally feel that the system partition should be reserved for the operating system and any program executables. All data files should be located on another partition. This will make recovery and disaster planning much easier. I have even made relocating IIS extremely easy by creating a command file that will install IIS into the location you want using a single command line statement. So, if you want, you can easily relocate C:\InetPub\wwwroot -> D:\InetPub\wwwroot – I like D:\Webs myself.

Basically, what you would have to do is create a setup answer file that specifies the components to activate and the locations of the file hives. Once you have created this file, you install IIS using the sysocmgr.exe setup application and reference the answer file that you have created. I have created a command file that will do this for you. All you have to do is run the command file, and as parameters provide the locations for the wwwroot and ftproot paths. This will fire the setup application, install and configure IIS in the location you want. Just make sure that you have access to the Operating System installation files either through a local path, network share, or CD.

To create this command file, open Notepad and paste the text from the gray area below. Save the file with the name iisreloc.cmd.

 

 
@echo off
 
REM 1st Parameter - Location to WWWroot ex. D:\Inetpub\Ftproot
REM 2nd Parameter - Location to FTProot ex. D:\Inetpub\Wwwroot
 
if "%1" == "" goto USAGE
if "%2" == "" goto USAGE
 
echo [Components] > %TEMP%\iisreloc.tmp
echo iis_common=on            ;IIS Common Services >> %TEMP%\iisreloc.tmp
echo iisdbg=on             ;MS Script Debugger >> %TEMP%\iisreloc.tmp
echo iis_doc=off            ;IIS Documentation >> %TEMP%\iisreloc.tmp
echo iis_ftp=off            ;IIS FTP Service >> %TEMP%\iisreloc.tmp
echo iis_htmla=off            ;IIS HTML Administration Files >> %TEMP%\iisreloc.tmp
echo iis_inetmgr=on            ;IIS MMC Snap-in >> %TEMP%\iisreloc.tmp
echo iis_nntp=off            ;IIS NNTP Service >> %TEMP%\iisreloc.tmp
echo iis_nntp_docs=off        ;IIS NNTP Documentation >> %TEMP%\iisreloc.tmp
echo iis_pwmgr=off            ;Personal Web Manager Application >> %TEMP%\iisreloc.tmp
echo iis_smtp=off            ;IIS SMTP Service >> %TEMP%\iisreloc.tmp
echo iis_smtp_docs=off        ;IIS SMTP Documentation >> %TEMP%\iisreloc.tmp
echo iis_www=on            ;IIS WWW Service >> %TEMP%\iisreloc.tmp
echo Mts_core = On            ;Microsoft Transaction Server core components\ >> %TEMP%\iisreloc.tmp
echo Indexsrv_system = off        ;Index Service >> %TEMP%\iisreloc.tmp
echo fp_extensions=off        ;Frontpage Server Extensions - found this and the other >> %TEMP%\iisreloc.tmp
echo [InternetServer] >> %TEMP%\iisreloc.tmp
echo PathFTPRoot=%2        ;Install path for FTP service >> %TEMP%\iisreloc.tmp
echo PathWWWRoot=%1        ;Install path for WWW service >> %TEMP%\iisreloc.tmp
 
sysocmgr /i:%windir%\inf\sysoc.inf /u:%TEMP%\iisreloc.tmp
 
goto EXIT
 
:USAGE
echo .
echo Usage: iisreloc.cmd [wwwroot path] [ftproot path]
echo .
 
:EXIT
 

 

You can find out more information about creating the answer file on Microsoft's website at http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/80455459-01b0-4961-aeab-081ce2eb03a4.mspx?mfr=true.

If you want to configure IIS during OS installation add the sections generated in the script, or described in the Microsoft document above to your unattended.txt or winnt.sif file.

 

For Example:

If you wanted to install the IIS hive at D:\InetPub instead of C:\InetPub run the command file using the following syntax:

Iisreloc.cmd D:\InetPub\wwwroot D:\InetPub\ftproot

 

March 06

NotFound result from the OfficialFile.asmx WebService

Pushing documents to a Record Center via the OfficialFile.asmx

Recently I was attempting to write an application that would push documents into a Microsoft Office SharePoint Server (MOSS) Record Center.  The application that I was using is a Windows Forms application and it used the officialfile.asmx web service and its SubmitFile method to push a file to the Records Center.  Every time I tried to submit a file using the web service, NotFound would be returned as the result

Result String from the SubmitFile Web Service Method

<ResultCode>NotFound</ResultCode>

After a while (a long while), I finally found the solution.   There is site group that authorizes the users who are allowed to submit using the web service. It is the Records Center Web Service Submitters group.  Add your user or the Authenticated Users Active Directory Security Group to this group to grant permission to that user.  If you want to push items to Records Center from an external application using the officialfile.asmx web service provided with MOSS you must add the users to the Records Center Web Service Submitters group. By default this site group does not have any members, therefore effectively preventing ANYONE from using the SubmitFile method of the web service. The result of NotFound that I was receiving was because the user credentials did not exist in the mentioned site group.

 

Feed

The owner hasn't specified a feed for this module yet.
No list items have been added yet.