To resolve this issue, create and compile the GUIDConvert.dll file. To do this, follow these steps. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
- Install version 1.1 of the Microsoft .NET Framework if it is not already installed. You can automatically install version 1.1 of the .NET Framework from the Windows Update Web site. Or, visit the following Microsoft Web site to obtain the .NET Framework version 1.1 Redistributable Package program:
- Install version 1.1 of the .NET Framework Software Development Kit (SDK) if it is not already installed. To obtain version 1.1 of the .NET Framework SDK, follow these steps.
Note If you have Microsoft Visual Studio .NET 2003 installed, you do not have to install version 1.1 of the .NET Framework SDK. Version 1.1 of the .NET Framework SDK is included with Visual Studio .NET 2003.- Start a Web browser program such as Microsoft Internet Explorer, and then visit the following Microsoft Web site:
- Click the Get the .NET Framework 1.1 SDK link, and then click the Download link.
- Click Open to start the Setup.exe program.
Note This file is more than 100 megabytes (MB). Therefore, you may want to save the file to the local computer and then double-click the executable file to run Setup.
- Change the PATH environment variable to point to the C# compiler (Csc.exe). This is typically the following folder location
%WINDIR%\Microsoft .NET\Framework\version number
where version number is the .NET Framework 1.1 version number.
To change the PATH variable, follow these steps:- Click Start, right-click My Computer, and then click Properties.
- Click the Advanced tab, and then click Environment Variables.
- Under System variables, click Path, and then click Edit.
- Type the following at the end of the path statement in the Variable value box
;C:\Windows\Microsoft.NET\Framework\v1.1.4322
where C:\Windows is the folder where Windows is installed and where v1.1.4322 is the .NET Framework 1.1 version number.
Note There is a semicolon character at the beginning of the text, and there is no space between "Microsoft" and ".NET." - Click OK three times.
- Change the PATH environment variable to point to the following folder location (where various tools are located)
C:\Program Files\Microsoft .NET\SDK\v1.1\Bin
where C: is the drive where Windows is installed. To change the PATH variable, follow these steps:- Click Start, right-click My Computer, and then click Properties.
- Click the Advanced tab, and then click Environment Variables.
- Under System variables, click Path, and then click Edit.
- Type the following at the end of the path statement in the Variable value box:
;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin
Note There is a semicolon character at the beginning of the text, and there is no space between "Microsoft" and ".NET." - Click OK three times.
- Type or paste the following code into a file that is named Convert.cs, and then copy Convert.cs to a folder. For example, copy the Convert.cs file to c:\risscript.
/* This is a code sample that shows how you might create a
* .dll that converts a hexadecimal string into a binary
* array using the C# language.
*/
using System;
using System.Runtime.InteropServices;
using System.Reflection;
[assembly:AssemblyKeyFile(@"guidconvert.snk")]
namespace GUIDConvert
{
[GuidAttribute("A39C5763-41CE-4ee1-A702-56D45BF589D5")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IConvert
{
byte[] MakeGUIDByteArray(string s);
}
[GuidAttribute("0F9A4464-A30C-46d2-9D35-D08E56A34CF2")]
public class Convert : IConvert
{
public Convert()
{
}
public byte[] MakeGUIDByteArray(string s)
{
Guid guid = new Guid(s);
return guid.ToByteArray();
}
}
}
- Start a command prompt, and then change to the folder location where you stored the Convert.cs file.
- Type the following command (and then press ENTER) to produce a key pair for signing the DLL file:
Sn.exe -k GUIDConvert.snk
- In the same folder location, type the following command to compile the C# code:
csc /t:library /out:GUIDConvert.dll /optimize convert.cs
- In the same folder location, type the following command to install the GUIDConvert.dll file in the global assembly cache (GAC):
gacutil /i GUIDConvert.dll
- In the same folder location, type the following command to register the GUIDConvert.dll file on the local computer:
regasm GUIDConvert.dll /tlb
- Make sure that the GUIDConvert.dll file is in the same folder as the Windows Server 2003 Deployment Kit script that requires it.
You can now use the GUIDConvert.dll file (together with a script) to prestage clients in Active Directory. The PrestagRISClnt.txt sample script describes how to do this. You can find PrestagRISClnt.txt in the
Windows Server 2003 Deployment Kit: Automating and Customizing Installations book.