Monday, December 22, 2008

How to View ESX Running Tasks

Sometime when you are managing your ESX hosts with VC connection to your VI, you might get the 'connection time out' when doing something that takes longer that 15 minutes (hard coded), for example, merging/deleting a huge snapshot file

To view whether or not the task is still running on your host, SSH to your host

#> vimsh

[/]$ vimsvc/task_list
(ManagedObjectReference) [
'vim.Task:haTask-1488-vim.vm.Snapshot.remove-169152700', 'vim.Task:haTask-1520-vim.VirtualMachine.removeAllSnapshots-169152743', 'vim.Task:haTask-1520-vim.vm.Snapshot.remove-169152682', 'vim.Task:haTask-ha-root-pool-vim.ResourcePool.createResourcePool-169152886', 'vim.Task:haTask-ha-root-pool-vim.ResourcePool.updateConfig-169152786'
]

To view a specific task:

[/]$ vimsvc/task_info haTask-1488-vim.vm.Snapshot.remove-169152700
(vim.TaskInfo) {
dynamicType = ,
key = "haTask-1488-vim.vm.Snapshot.remove-169152700",
task = 'vim.Task:haTask-1488-vim.vm.Snapshot.remove-169152700',
name = "vim.vm.Snapshot.remove",
descriptionId = "vm.Snapshot.remove",
entity = 'vim.VirtualMachine:1488',
entityName = "ausyddbt04",
state = "running",
cancelled = false,
cancelable = false,
error = (vmodl.MethodFault) null,
result = ,
progress = 95,
reason = (vim.TaskReasonUser)
{ dynamicType = , userName = "vpxuser", }, queueTime = "2008-12-22T03:29:20.870373Z", startTime = "2008-12-22T03:29:20.870373Z", completeTime = , eventChainId = 169152700,
}

Thursday, November 20, 2008

ESX Change Service Console IP Address

Delete existing VSWIF0:

esxcfg-vswif -d vswif0

Add a new one:

esxcfg-vswif -a vswif0 -p Service\ Console -i 10.1.1.1 -n 255.255.255.0 -b 10.1.1.255

Note: -i is the IP address, -n is the subnet and -b is the broadcast address

If you need to change the default gateway, edit the:

/etc/sysconfig/network

Dont forget to change the /etc/hosts file as well

reboot!

Wednesday, November 12, 2008

Printer Queue Stuck

After printing a job, the print indicator window only goes to 99% and the job never completes itself, although the paper spits out and it is finished. If you try to then print another job, it won't print because it thinks the first job isn't done (but it is).

When you try to open the queue, the first document says "Deleting- printed". It's almost like it's stuck at deleting the old job.

Do this:
- Stop the "Print Spooler" service.
- Delete all the existing print spool files. (Stored in "C:\WINDOWS\system32\spool\PRINTERS" by default).
- Start the "Print Spooler" service.
- Right-click the printer's icon in the Printers and Faxes folder and choose Properties.
- Click the Advanced tab.
- Click the Print Processor... button.
- Make a note of the existing "Print processor" selection on the left (in case you need to revert it.). Then change it to "WinPrint". Click OK.
- Click OK on the printer's properties window.
- Try sending a print job to see whether it persists in the print queue.

Sunday, October 12, 2008

Passed 70-444 TodaY!!

Woooohooo~~ I passed 70-444 exam today which means I am officially MCITP Database Administrator (SQL 2005)! Don't really like to be a DBA but this helps me getting more details understanding of SQL 2005

How exciting after a loooooong night study for the last 3 months :)

Wednesday, September 03, 2008

Remove Offline Folder Share

Continuing from my previous blog about migrating file and print server, the clients might try to sync the offline folder to both old and new server. To fix this

disable offline folders
delete all the files in c:\windows\csc
enable offline folders

Monday, September 01, 2008

Re-Mapping Shared Folders or Printers

When you are tasked to migrate a file/print server, you have 2 options - keep the same server name for the new server or use a new name.

Keeping the same server name is an easier solution - you can build a new server with a temp name, do whatever you need to do and when the cutover time, rename the old server name to something else and name the new server to the old server name.

However, this approach is not always an option for you. If you need to use a different name for your new server, you need to somehow re-map all the shared folders and printers to the new file/print server.

Here is the script to map the printers:

' Full path to text file containing list of printer share names. e.g.
' OldPrinter1,NewPrinterA

Const PRINTERS_FILE = "\\server\printers$\new-printers.csv"

'Old and new Printer Server information
Const OLD_SERVER = "\\oldservername"
Const NEW_SERVER = "\\newservername"

'Create something to store the list of printers in
Set objPrinters = CreateObject("Scripting.Dictionary")

'Open the File in Read Only mode
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.OpenTextFile(PRINTERS_FILE, 1, False, 0)

Do While Not objFile.AtEndOfStream
arrLine = Split(objFile.ReadLine, ",")

' Load each printer entry into memory (keyed list, key is the old printer name)
If Not objPrinters.Exists(arrLine(0)) Then
objPrinters.Add LCase(arrLine(0)), LCase(arrLine(1))
End If

Loop

Set objFile = Nothing
Set objFileSystem = Nothing
Set objWSH = CreateObject("WScript.Network")

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer WHERE Network=True",,48)

For Each objPrinter in colItems
If UCase(objPrinter.ServerName) = UCase(OLD_SERVER) Then
strPrinter = LCase(objPrinter.ShareName)
strOldPrinterPath = objPrinter.ServerName & "\" & strPrinter

'Remove any printer still connected to OLD_SERVER
objWSH.RemovePrinterConnection strOldPrinterPath, True, True

'See if the old Printer exists in the file (from memory)
If objPrinters.Exists(strPrinter) Then

' Create the new Printer Path
strNewPrinterPath = NEW_SERVER & "\" & objPrinters(strPrinter)
Err.Clear

' Add the new Printer Connection
objWSH.AddWindowsPrinterConnection strNewPrinterPath

If objPrinter.Default = "True" Then
objWSH.SetDefaultPrinter strNewPrinterPath
End If
End If
End If
Next

Set colItems = Nothing
Set objWMIService = Nothing
Set objWSH = Nothing
Set objPrinters = Nothing

Here is the script to map the shared folder:

' Full path to text file containing list of share names. e.g.
' OldShared,NewShared Const
SHARES_FILE = "\\server\printers$\new-shares.csv"

' Old and new Server information
Const OLD_SERVER = "oldserver"
Const NEW_SERVER = "newserver"

' Create something to store the list of shares in
Set objShares = CreateObject("Scripting.Dictionary")

' Open the File in Read Only mode
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.OpenTextFile(SHARES_FILE, 1, False, 0)

Do While Not objFile.AtEndOfStream
arrLine = Split(objFile.ReadLine, ",")

' Load each shares entry into memory (keyed list, key is the old printer name)
If Not objShares.Exists(arrLine(0)) Then
objShares.Add LCase(arrLine(0)), LCase(arrLine(1))
End If
Loop

Set objFile = Nothing
Set objFileSystem = Nothing

'Create a filesystem object
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")

'Create a drives collection
Set Drives = FileSystemObject.Drives

Dim objNetwork, strDriveLetter
Set objNetwork = CreateObject("WScript.Network")

'step through the drive collection, and extract'the drive letter and the type of drive
'according to the Microsoft VBScript documentation'there are 6 distinct types of drive

For Each DiskDrive in Drives
DriveLetter = DiskDrive.DriveLetter
DriveType = DiskDrive.DriveType

strDriveLetter = DriveLetter & ":"

Select Case DriveType
Case "0" DriveType = "Unknown type of drive"
Case "1" DriveType = "Removable drive"
Case "2" DriveType = "Fixed drive"
Case "3" DriveType = "Network drive"
Path = DiskDrive.ShareName
'get the server name of this shared folder
Temp = Right( Path, Len( Path ) - 2 )
IndexOfSlash = InStr( Temp, "\" )

OldServerName = Left( Temp, IndexOfSlash - 1 )

'get the shared name
OldSharedName = Right( Temp, Len( Temp ) - Len(OldServerName) - 1 )

'we only touch the shared folder in the old server
If UCase( OldServerName ) = UCase( OLD_SERVER ) Then
'is this the old shared name
If objShares.Exists( OldSharedName ) Then
'delete the old mapping drive
objNetwork.RemoveNetworkDrive strDriveLetter, True, True

strNetworkPath = "\\" & NEW_SERVER & "\" & objShares(OldSharedName )

'sleeping for a while
WScript.sleep 3000

'map the new drive persistently
objNetwork.MapNetworkDrive strDriveLetter, strNetworkPath, True
End If
End If
Case "4" DriveType = "CD-ROM drive"
Case "5" DriveType = "RAM Disk"
End Select
Next

Set Drives = nothing
Set FileSystemObject = nothing
Set objNetwork = nothing
Set objShares = nothing

Good Luck

Sunday, August 10, 2008

MCITP One More to GO!!

After a long journey of studying, finally I finished my study of SQL 2005 and took the 70-443 exam today with the score 970.

This is part of my goal to get the MCITP: Database Administrator which I need to sit on one more exam 70-444 to finalize this.

As per my prev post, I am working with SQL 2005 servers and it gets me excited to know more

Wednesday, July 09, 2008

Windows 2000 Domain Controller - Restore Trust Relationship

If your domain controllers are not replicated to each other and your are getting the following errors:

netdiag

DC list test . . . . . . . . . . . :[WARNING] Cannot call DsBind to DC1). [SEC_E_WRONG_PRINCIPAL]

dcdiag

Warning: DC1 is the Schema Owner, but is not responding to DSRPC Bind.[DC1] LDAP bind failed with error 31,A device attached to the system is not functioning..

Warning: DC1 is the Schema Owner, but is not responding to LDAP Bind.
Warning: DC1 is the Domain Owner, but is not responding to DSRPC Bind.
Warning: DC1 is the Domain Owner, but is not responding to LDAP Bind.
Warning: DC1 is the PDC Owner, but is not responding to DS RPC Bind.
Warning: DC1 is the PDC Owner, but is not responding to LDAPBind.
Warning: DC1 is the Rid Owner, but is not responding to DS RPC Bind.
Warning: DC1 is the Rid Owner, but is not responding to LDAPBind.
Warning: DC1 is the Infrastructure Update Owner, but is not responding to DS RPC Bind.
Warning: DC1 is the Infrastructure Update Owner, but is not responding to LDAP Bind.

It could be the trust relationship between the domain controller is broken. To establish the trust back, do the following:

1. Find the PDC Role

netdom query fsmo

2. Reset the computer account password from the other Domain Controller

net stop kdc

netdom resetpwd /server: /userd: /passwordd:

reboot

Thursday, June 12, 2008

Kerberos Ticket Granting Ticket

One day - I was setting up WSUS and creating GPO that only applies (with Security Filtering) to a security group that has computer accounts as a member of. So I started adding computers to this new security group.

I waited... waited... and waited... but nothing happened on the WSUS console. Those computers that I added to the security group do not appear on the WSUS console.

I ran the gpresult and found out that the GPO has not been applied to the computer. I ran gpupdate /force so many time, but nothing was working.

It turns out that the computer would not know about its membership until the Kerberos TGT is renewed. To renew the ticket, the computer has to be restarted, wait for 7 days (default value) or use klist.exe to purge the ticket and renew it. Because the computer does not know anything about its new membership, the GPO wasn't applied to it.

To use KLIST, do the following:
  • get psexec.exe from MS SysInternals
  • get the klist.exe from Windows Resource Tool Kit
  • get the nltest.ext from Windows Resource Tool Kit
  • run the cmd.exe as a system shell:

psexec.exe /i /s /d cmd.exe

  • from that new cmd prompt, run:

klist tgt

  • check when was the ticket renewed
  • to purge the tickets, run:

klist purge

  • to renew the tickets, run:

nltest /dclist:

Then you can run gpupdate /force again to force the GPO and then run wuauclt.exe /detectnow to register the client to the WSUS

Thursday, May 29, 2008

Citix Hanging at Mapping Client Drives

Quick tips [that works for me]:

If you are trying to login to a published application on Citrix and it was hanging on the "Mapping Client Drives" forever....

Go to the citrix server itself, try to restart the Citrix Print Manager service (or kill the cpsvc.exe process), restart the Print Spooler service and start the Citrix Print Manager again

Monday, May 19, 2008

Flex and .NET Web Service Error Handling

I was doing this Flex project that consumes .NET Web Service and could not figure out how to catch SOAPException from .NET Web Service.

It turns out that Flex could not read any response from the Web Service that has HTTP response code other then 200. You will get the following error (fault) from the Web Service if Flex was getting the HTTP response code other then 200:

FaultCode:Server.Error.Request
faultString:'HTTP request error'
faultDetail:'Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error.

Which is annoying because there was not specific details about the error!!

The workaround is to force .NET to return with the response status 200 if the response status code either 500 or 300.

You do this by put the following code in your application global.asax

<%@ language="C#" %>protected void Application_EndRequest(object sender,EventArgs e)
{
if(Context.Response.StatusCode==500 Context.Response.StatusCode == 300)
{
Context.Response.StatusCode = 200;
}
}

Wednesday, April 23, 2008

Blackberry Pearl 8100 + Bluetooth + NextG Telstra

Ever wondering how to use your Telstra NextG Blackberry Pearl on your laptop as a wireless modem? read on...

first, turn on the bluetooth on your blackberry and make is discoverable
turn on the bluetooth on your laptop and search for your blackberry

set your laptop connection on your blackberry as a trust connection

your laptop should detect the blackberry as a modem

go to control panel, go to phones and modem, find the new modem of your blackberry
go to its properties, click on advanced and put the following:

+CGDCONT=1,"IP","telstra.internet"

if you are using Telstra use the APN of Telstra which is: telstra.internet, otherwise, you need to find out from your service provider

create a dial up connection, use that modem - no username and password needed
the number to dial is: *99#

dial and connect!

Monday, April 07, 2008

Find the users' OU from Active Directory

If you need to find the Active Directory user accounts' OU, run the following script:

Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection


objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

REM get the filename
If WSCript.Arguments.Count <> 1 Then
WScript.Echo "Text file contains user accounts must be supplied"
WScript.Quit 0
End If

dim filenamefilename = WScript.Arguments.Item(0)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")

Const ForReading = 1

Set objFile = objFSO.OpenTextFile (filename, ForReading)

i = 0
Do Until objFile.AtEndOfStream
strNextLine = objFile.Readline
If strNextLine <> "" Then
getOu strNextLine
End If

i = i + 1
Loop

objFile.Close

REM Sub to get username OU


Sub getOu( username )
objCommand.CommandText = "SELECT distinguishedName FROM 'LDAP://dc=domain,dc=com'" & "WHERE objectCategory='user' " & "AND sAMAccountName='" & username & "'"

Set objRecordSet = objCommand.Execute

If objRecordSet.EOF Then
WScript.Echo username & " does not exist "
Else
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName").Value
arrPath = Split(strDN, ",")
dim uOu

for each ou in arrPath
if Left( ou, 3 ) = "OU=" Then
if uOu = "" Then
uOu = ou
else

uOu = uOu & "," & ou
end if

end if
Next


uOu = username & " : " & uOu
Wscript.Echo uOu

objRecordSet.MoveNext
Loop
End If
End Sub

copy the above code to .vbs file (e.g. getOu.vbs). You also need to change the domain name from the LDAP query to your domain name in the code above.

Next, you need to create a text file just having a username per-line, e.g. users.txt

bgates
dduck

Next, run the the following:

cscript getOu.vbs c:\users.txt

Friday, April 04, 2008

View SQL 2005 Table Fragmentation

To view how fragmented your table is, run the following query:

USE dbname
GO
SELECT CAST(DB_NAME(DATABASE_ID) AS VARCHAR(20)) AS 'DatabaseName',
CAST(OBJECT_NAME([OBJECT_ID]) AS VARCHAR(20)) AS 'TableName',
INDEX_ID,
CAST(INDEX_TYPE_DESC AS VARCHAR(20)) AS INDEX_TYPE_DESC,
AVG_FRAGMENTATION_IN_PERCENT
FROM SYS.DM_DB_INDEX_PHYSICAL_STATS (DB_ID('dbname'),OBJECT_ID('dbo.tablename'),NULL,NULL,NULL );
GO

Sunday, March 09, 2008

Microsoft SQL 2005 Failover Cluster

Today, I'd like to share creating SQL 2005 Failover Cluster with Microsoft Virtual Server 2005. This involves creating 3x virtual Windows 2003 Enterprise Edition on Virtual Server, creating Quorum disks, configuring cluster and installing SQL 2005

To start, download the Microsoft Virtual Server 2005 here, Virtual Machine Remote Control Client Plus here. Install the Virtual Server 2005, but don't install the Web Server Administration part - we are going to manage it with the VMRCplus. Install the VMRCplus once the Virtual Server 2005 installation finished.

Create a Windows 2003 Enterprise Edition Template

Create a new virtual machine template with the following specs:
1x Dynamic HDD (IDE) - size: 10GB
1x NIC - connects to the Internal Network
512MB RAM

sql-2005-cluster-1

Boot the VM, install Windows 2003 Ent edition, install the VM additional tools and sysprep the machine, shut down

Create a Domain Controller

Create a new virtual machine with the following specs:
Parent: Template
1x Differencing HDD (IDE) - size: 10 GB

sql-2005-cluster-2

1x NIC - connects to the Internal Network

start the virtual machine and do the following:
  • rename the machine to: DC
  • give an IP address: 192.168.0.1
  • install DNS
  • dcpromo
  • reboot
  • create 2x service accounts: _cluster and _sql
  • create domain group for SQL cluster: SQL Cluster
Create a Virtual Heartbeat Network

Create a new virtual network to be used by the cluster for heartbeat. From VM manager, click on Virtual Networks and Create a new network, with physical adapter: None (Guests Only)

sql-2005-cluster-3

Create The First Node (NODE1)

Create a new virtual machine with the following specs:
Parent: Template
1x Differencing HDD (IDE) - size: 10 GB
3x SCSI Adapters - all with Share SCSI bus and using SCSI adapter ID: 7
2x NIC - connects to the Internal Network and Heartbeat Network
3x Fixed HDD (SCSI) - size: 1GB (cluster quorum), 10GB (SQL data shared drive) and 1GB (MSDTC shared drive)

sql-2005-cluster-4

sql-2005-cluster-5

start the virtual machine and do the following:
  • rename the machine to: NODE1
  • change the IP address: NIC1: 192.168.0.10/24, DNS: 192.168.0.1; NIC2: 10.0.0.1/8
  • join the computer to the domain
  • reboot
  • activate 3x SCSI drives, primary partition: cluster quorum -> Q:, SQL data -> S:, MSDTC -> M:
  • install .net framework 2
  • install 'Enable network DTC access'
  • shutdown
Create The Second Node (NODE2)

Create a new virtual machine with the following specs:
Parent: Template
1x Differencing HDD (IDE) - size: 10 GB
2x NIC - connects to the Internal Network and Heartbeat Network
3x SCSI Adapters - all with Share SCSI bus and using SCSI adapter ID: 7. Assign the HDD (.vhd) files to the NODE1 vhd files according to its purposes (e.g. SCSI 0:0 -> cluster quorum, SCSI 1:0 -> SQL data shared drive, SCSI 3:0 -> MSDTC drive)

sql-2005-cluster-6

start the virtual machine and do the following:
  • rename the machine to: NODE2
  • change the IP address: NIC1: 192.168.0.2024, DNS: 192.168.0.1; NIC2: 10.0.0.2/8
  • join the computer to the domain
  • reboot
  • assign drive letters to 3x SCSI drives: cluster quorum -> Q:, SQL data -> S:, MSDTC -> M:
  • install .net framework 2
  • install 'Enable network DTC access'
  • shutdown

Create a Cluster

Start NODE1 virtual machine (make sure NODE2 is off)
start the cluster administratorr
create a new cluster, named: SQL
cluster IP address: 192.168.0.30
cluster account: _cluster
choose Q: as the quorum drive

Start NODE2

On NODE1 do the followings:
add NODE2 to the cluster
change the preference of the private network to use the second NIC card

Create Resource Group For MSDTC

on NODE1, start the cluster administrator and do the followings:
  • rename the Group1 groups to MSDTC
  • create a new resource, IP address; no dependencies, both NODE1 and NODE2 as possible owners and IP address: 192.168.0.40/24
  • create a new resource, Network Name; depends on IP address, both NODE1 and NODE2 as possible owners and Network Name: MSDTC
  • create a new resource, Distributed Transaction Coordinator; depends on Disk M: and Network Name

To enable MSDTC, do the followings:
  • In Control Panel, open "Component services".
  • Expand Component Services, expand Computers, right-click My Computer, and then click Properties.
  • On the MSDTC tab, click Secuity Configuration under Transaction Configuration, click to select the Network DTC Access check box under Secuity Settings, and then click to select the following check boxes under Transaction Manager Communication:• Allow Inbound• Allow Outbound
  • You cannot select Mutual Authentication Required. Therefore, click to select one of the following check boxes:• Incoming Caller Authentication Required• No Authentication RequiredNote For more information about these options, click the following article number to view the article in the Microsoft Knowledge Base:899191 (http://support.microsoft.com/kb/899191/) New functionality in the Distributed Transaction Coordinator service in Windows Server 2003 Service Pack 1 and in Windows XP Service Pack 2
  • Make sure that the Logon Account is set to NTAUTHORITY\NetworkService.
  • Click OK. A message box explains that the MS DTC Service will be stopped and restarted, and that all dependent services will also be stopped and restarted. Click Yes.
    Note If this is a Majority Node Set (MNS) cluster, do not use the MNS resource as the storage device for MS DTC. MS DTC requires a storage resource such as a physical disk.
  • Restart NODE1.
once NODE1 restarted, restart NODE2

Create Resource Group For SQL

on NODE1, start the cluster administrator and do the followings:
  • rename Group0 to SQL
  • make sure NODE1 is the active node for S: drive, cluster and MSDTC

SQL 2005 Installation

run the SQL 2005 setup
on 'Components to Install' setup page, make sure the 'failover cluster' option is selected

sql-2005-cluster-7

virtual servername: sql-cluster
network use: publicIP address: 192.168.0.50

on 'Cluster Group Selection' setup page, select the SQL cluster group for the virtual server resources
make sure NODE2 is selected on the nodes to be included in the virtual server
use the _sql user account for all the services
specify 'NET\SQL Cluster ' as the domain group

Testing

once the SQL 2005 installation finished, you can try to failover the cluster from one node to the other by 'Move Group' from the SQL resource group option

you can also try install the SQL Management Studio on the other computer (e.g. DC) and try to connect to the clustered name of the SQL - sql-cluster.domain.com

sql-2005-cluster-8

References:
http://msdn2.microsoft.com/en-us/library/ms179530.aspx
http://msdn2.microsoft.com/en-us/library/ms189910.aspx
http://support.microsoft.com/kb/301600
http://support.microsoft.com/kb/817064
http://support.microsoft.com/kb/258750

Wednesday, February 13, 2008

Reverse Proxy with IIS

Have you ever needed to do reverse proxy using IIS? if yes, read on.

You need to have ISAPI REWRITE product from here
Install on your IIS server and put the following code:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^my.external-domain.com$

RewriteProxy ^(.*) http://my.internal-domain.com:9999/$1 [H,A,L]

This allows you to access my.external-domain.com from the Internet over HTTP (Port 80) and then proxied by IIS with the help of ISAPI to your my.internal-domain.com port 9999 which is located on the other internal 'inaccessible-from-the-Internet' server.

Monday, February 04, 2008

Windows Systems Wide Proxy

Sometime an application needs to be able to use a proxy to run properly. The best approach to do this is the application is able to adapt with the Internet Explorer proxy setting.

However, some applications are not 'smart' enough to get the proxy setting from the IE, therefore, a systems wide setting must be set.

Prior to Windows Vista, systems wide proxy setting is set by using: proxycfg.exe
With Windows Vista, you need to do:

netsh
netsh> winhttp
netsh winhttp> set proxy proxy.domain.tld:8080

Note: You must run this from CMD 'run as administrator'

Wednesday, January 30, 2008

Publish InfoPath Form to SharePoint Server 2007

This documentation will guide you how to publish an InfoPath form to SharePoint Server 2007. Published forms in SharePoint will be used as a template in a library, particularly in a form library.

Create a Form Library

You need a Form Library in SharePoint before you publish the InfoPath form as a template to the library. If you can publish directly from InfoPath to SharePoint, you have the option to create the library on-the-fly when you are publishing the form using the publishing wizard. However, if you need to publish it manually, the library must be created before the form is published.
To create a form library, go to any site collection and click on Site Actions – Create (you must have permission to do this)

infopath-sharepoint-1

Under Libraries, choose the Form Library. Enter the name of the library, description and click the Create button

Create the InfoPath Form

Start designing the InfoPath form template. Make sure when creating a new form template, the ‘enable browser-compatible features only’ is checked – if you want to be able to open the form from the web browser. This allows users to view/open the forms without having to have InfoPath application installed on their PC.

infopath-sharepoint-2

This document does not teach you how to design an InfoPath form. Please visit Microsoft website for more details how to design InfoPath form.

Setup the InfoPath Property Promotion

You can promote the properties of the InfoPath form so that they become available as the content type of the form library in SharePoint. This allows you to view the properties of the InfoPath form directly from the SharePoint columns of the library.

From the InfoPath click: Tools – Form Options …
Click on Property Promotion category
Click Add… button and choose the fields to be added and click OK

infopath-sharepoint-3

infopath-sharepoint-4


Setup the InfoPath Compatibility

After you have finished designing your template, set the compatibility to be web browser enabled.
From the InfoPath click: Tools – Form Options …
Click on Compatibility category
Tick the ‘Design a form template that can be opened in a browser or InfoPath’ checkbox

infopath-sharepoint-5

Optionally, you can enter the URL where the Forms Services is running to verify the form with the server

Setup the InfoPath Security Setting

Security setting must be set to: Domain
From the InfoPath click: Tools – Form Options …
Click on Security and Trust category
Select the Domain radio box

infopath-sharepoint-6


Verify the InfoPath Form

Click on the Design Checker from the Design Tasks panel once you are ready to publish the form

infopath-sharepoint-7

infopath-sharepoint-8

Make sure you are getting 0 errors:

infopath-sharepoint-9

Publish the Form Template to SharePoint

To publish the form to SharePoint, click on Publish Form Template… from the Design Tasks panel

infopath-sharepoint-10

From the publishing wizard, you will see four options. You can try to publish directly to a SharePoint server by choosing the first option

infopath-sharepoint-11

Enter the URL of your site collection in which you created the form library


infopath-sharepoint-12

However, you might get the following error message:

infopath-sharepoint-13

If you are getting this error message, it is most likely that you cannot publish the form directly to the SharePoint server. Microsoft does not have solution at the time of this writing – workaround will be discussed later (Publish to a network location). Note this error only happens to InfoPath 2007. If you are using InfoPath 2003, most of the time you can publish directly to SharePoint.

If you are not getting the error message, you will be prompted to choose which library do you want to publish the form template to. Just follow the wizard.

If you successfully published the form directly to the SharePoint, you should have a new form template replaced with your InfoPath form template in your form library when you are creating a new document from the library

infopath-sharepoint-14

Publish InfoPath to a Network Location

This publishing method is an alternative or work around to publish the InfoPath form to SharePoint if the form can not be published directly to the SharePoint.

To publish the form to a network location, click on Publish Form Template… from the Design Tasks panel

infopath-sharepoint-15

From the publishing wizard, choose the third option

infopath-sharepoint-16

Specify the form template path where to save the form template (local or shared folder) and give the name for the form template

infopath-sharepoint-17

For the access path, make sure you left this field empty (!!)


infopath-sharepoint-18

Warning dialog box come out, click OK

infopath-sharepoint-19

Click Publish to finish

infopath-sharepoint-20

Upload The Published InfoPath Form Template to the MOSS Form Templates

You must have permission to SharePoint central administration to upload the form to form templates.

Go to Central Administration – Application Management
Under InfoPath Forms Services, click on Upload form template
Browse to the form that published earlier and click Upload
If you see error message, fix the template and try to upload again

Activate the New Form Template

The new form template must be activated before it can be used throughout a site collection.
Go to Central Administration – Application Management
Under InfoPath Forms Services, click on Manage Form Templates
Find the new form click on the arrow button and choose Activate to a Site Collection

infopath-sharepoint-21

Choose the site collection and click OK


Add the content type to the Form Library

Once the form template has been activated, the template can be used as a new content type for a library.

To assign the form template as a content type for a form library:
Go to the form library
Click on Settings – Form Library Setting


infopath-sharepoint-22

Under General Settings, click on Advanced settings
Choose Yes for allow management of content types, and click OK
Under Content Types, click on Add from existing site content type
From available Site Content Types, choose the new content type, click Add > and OK

infopath-sharepoint-23

Note: Under columns, you should see new columns that are the template properties being promoted earlier

infopath-sharepoint-24


Assign the Columns to View

By default, the view does not show the new content types. View must be changed to be able to show the content types.

From the form library, click on View: All Documents – Modify this View

infopath-sharepoint-25

Under Columns, tick the checkboxes that needs to be displayed and change the position as needed

infopath-sharepoint-26

Test the Template

The template has now been assigned to the form library. If you click new, you should see the new template name

infopath-sharepoint-27

If you choose the new template, is should open the InfoPath application (if you have it installed on your PC) or render the form to HTML based form. Once you have finished filling out the form, it depends on how the form was designed, it should be saved to the form library

When the form is saved to the library, you will see the properties of the from are picked up by the columns content type

infopath-sharepoint-28