Skip to content

OSDComputerName variable and .Net

Featured Replies

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?

 

 

  • 2 weeks later...

Join the conversation

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

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.