Jump to content


  • 0
RaymondA

OSDComputerName variable and .Net

Question

Hi,

 

I am investigating/considering to make an setup-screen in the OSD deployment.

I am using VS.net C#.

 

However, I am having major problems.

 

The idea I have is to give the user the option to change the installation values, if he clicks inside the app (10 seconds delay).

The application should displays:

Computername, Bitlocker, default regional settings, program packages, etc.

If he wants to change the computername, the program will help the user to make a name that’s unique and within Company Policy.

 

post-20850-0-36332000-1375880937_thumb.png

 

 

However, I need to evaluate the existing %OSDComputerName% variable.

 

I want to check if it is a SCCM generated name (“MININT-*“), if so the application should always stop and make the user create a computer name.

This section of the code is as follows:

            
TSEnvClass TSENVVAR = new TSEnvClass();
string sComputerName = "";           
try           
{              
compName = TSENVVAR["OSDComputerName"];             
this.textBoxComputername.Text = sComputerName;              
Log("OSDComputerName = " + sComputerName);          
}          
catch (Exception exc)            
{               
Logg(string.Format("ERROR OSDComputerName: {0}", exc));     
}

I also reads other settings, set by the Task Sequence prior to this step.

 

My problem is as follows:

 

I can read all variables, but the "default variables" are empty (zero length string).

 

I obviously am missing out on something. When, in the task sequence, is the default variables set and ready to use?

 

Or, am I doing something fundamentally wrong?

 

 

Second question... Is there some exception handling I should know about?

 

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

It is correct that OSDComputerName is empty when it is not used. The name is actually stored in the read-only variable _SMSTSMachineName and that value will be overwritten with the value of OSDComputerName (when used). See also: http://technet.microsoft.com/en-us/library/bb632442.aspx

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.