Archive for November, 2008

30
Nov
08

career change?

I started to find recently, this down term is finally starting to bite IT as well.

Not that it was unexpected but think when your close friend gives you behind story of how other companies are cutting down their IT related people.

Honestly, I don’t feel too comfortable either. This is even when my position is relatively safe as I am one man army in my role (Citrix support) and whole IT Operation is done by 5 people. (Already gone through reduction prior to myself joining the company)

another reason for not feeling good is that I only professionally worked since 1999 Dec, thats around 9 years of career time and I’ve already experienced two down terms. I don’t believe I am old but things are rosy nor will be rosy forever.

Well, I wish there is easier way or simple solution to save guard the future, but so far, I can only think re-arming myself with more knowledge is the way to go.

so I decided to apply for Law postgraduate. (yes… its crazy), lucky me, since I have a bachelor degree, getting an admission was not as hard as getting in to bachelor degree.

Question is… can will I survive for another 6 yrs of educationm after 7 yrs of undergraduate cource to graduate for a degree?

BTW, I have learnt that it is not too hard to start “Juris Doctor” (graduate degree for law) or even diploma of law to satisfy academic requirement to be a lawyer in NSW. It will only cost TIME, MONEY(dip,law is actually cheap) and effort to study.

Now, to commit or not to commit…

04
Nov
08

when 3.5 isnt good enough

I like new functions in framework but every new version has SOMETHING thats missing where I need most.

.net 3.5 came out with nice/better wrapper for the AD modification, yet it didnt give me the function to modify all the properties especially the tsprofilepath.

well I’ve found the alternative but you need to import DLL(Interop.TSUSEREXLIB.DLL) from here

then use the code below


using TSUSEREXLib;
using System.DirectoryServices;
using System;
using System.Collections.Generic;
using System.Text;

namespace Set_Terminal_Service_Properties
{
class Program
{
static void Main(string[] args)
{
string acctName = “chrisca”;
string tsHomeDrive = “H:”;
string tsHomeDirectory = “\\\\servername\\tshomedirectory\\”;
string tsProfilePath = “\\\\servername\\tsprofilepath\\”;
int enableLogon = 1; // enable terminal service logins

DirectoryEntry entry = new DirectoryEntry
(“LDAP://CN=Chris Calderon,CN=Users,DC=corp,DC=contoso,DC=com”);
ADsTSUserEx oUser = (ADsTSUserEx)entry.NativeObject;
oUser.AllowLogon = enableLogon;
oUser.TerminalServicesHomeDirectory = tsHomeDirectory + acctName;
oUser.TerminalServicesHomeDrive = tsHomeDrive;
oUser.TerminalServicesProfilePath = tsProfilePath + acctName;
entry.CommitChanges();
entry.Close();
}
}
}

Alternatively, my code looks like below (need reference to System.DirectoryServices.AccountManagement in .net 3.5)

var context = new PrincipalContext(ContextType.Domain);
var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, UserNameBox.Text);
Debug.WriteLine(“UserNameBox” + UserNameBox.Text);
ResultBox.Text = ResultBox.Text + Environment.NewLine + “ScriptPath ” + user.ScriptPath;
Debug.WriteLine(“user.GetGroups().Count()” + user.GetGroups().Count());
Debug.WriteLine(“user” + user.DistinguishedName);
foreach (GroupPrincipal group in user.GetGroups())
{
ResultBox.Text = ResultBox.Text + Environment.NewLine + group.SamAccountName;
}
DirectoryEntry de = new DirectoryEntry(“LDAP://”+user.DistinguishedName);

ADsTSUserEx tsu = (ADsTSUserEx)de.NativeObject;
Debug.WriteLine(“tspath” + tsu.TerminalServicesHomeDirectory );

Well using Interop will be messy but I think its better than writing process execute code to start vbs. (Alternative method is to use invokeSet, but I could not find better example so I’ve passed using it.)

Above original Code is refered from here