| Travis's profileTravis Lingenfelder's Bl...BlogLists | Help |
Travis Lingenfelder's Blog |
||||||
|
May 05 New Blog LocationThe 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 2008We 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 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 RetentionOverview 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") PowerShell Read configuration file into a HashTableThis PowerShell snippet will read the contents of an .ini style settings file into a HashTable. Example Setting.txt [General] 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 To get an item from the table use the command $h.Get_Item("MySetting1"). April 16 Visual Studio Add-in to get an assemblies PublicKeyTokenOften 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.
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 ControlsThe 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 LayoutsThe 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.
Add a reference to Microsoft.SharePoint.Publishing.dll to the project.
Now, let's add our code.
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 MethodologyYou 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 InvolvedThe DBB brings together the following practices and technologies to provide a consistent, repeatable deployment solution.
Process IntegrationThe 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 AreasUsing the guidance in the BDD helps IT organizations to accomplish the following areas:
BDD Components
BDD Solution TypesLite-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 ComeIf 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 LinksTechNet 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 hiveMany 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.
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 WebServicePushing documents to a Record Center via the OfficialFile.asmxRecently 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.
|
|||||
|
|