joeware - never stop exploring... :)

Information about joeware mixed with wild and crazy opinions...

4/14/2015

They said it couldn’t be done… NT4 in a 2012 R2 FFL6 Domain

by @ 6:09 pm. Filed under tech

I now have a Windows NT 4.0 Member Server joined and able to log into a 2012 R2 FFL6 Domain.

Don’t ask me why… If I told you I would have to kill you.

I will see about writing up how I worked through the WireShark traces to figure out what needed to be tweaked to get it to work or perhaps just the changes I needed to make to get it to work.

The most fun was getting NT4 running in 2012 R2 HyperV and not being able to use a mouse. Took me back a-ways (like almost 20 years) using all keyboard controls to whip around in NT4. But then most of my Enterprise (thousands of servers) NT4 work was done pre-RDP/TS days via remote command line through RCMD. You know remote command line management like they are pushing in PowerShell now like it is a new thing. 😉

It is just spectacular how fast NT4 runs in HyperV with no need for integration services… Oh and on a 1GB system disk that has 800MB free.

 

NT4in2012R2FFL6Forest

Rating 4.60 out of 5

9/8/2012

Barf…

by @ 2:30 pm. Filed under tech

 

image

 

I have determined that the new strategy to get people to move to powershell is to make the GUI experience so damn slow and bad you couldn’t possibly get any work done if you try to go that route.

Rating 4.33 out of 5

12/28/2011

Default Tombstone Lifetime yet again… Alternate working title: TechNet why do you hate tombstoneLifetime and correct information?

by @ 10:15 am. Filed under tech

Many moons ago I wrote a post about how a TechNet article on the default tombstone lifetime was wrong. That TechNet article eventually ended up getting corrected at some point though it doesn’t seem to be properly linked anymore to the GUID URL that I had for it – so much for theory of never losing TechNet articles again because they were "unique" GUID links… Regardless, it has been brought to my attention that once again a TechNet article has screwed this simple topic up when updating it for PowerShell[1].

http://technet.microsoft.com/en-us/library/dd392260(WS.10).aspx

Both here

By default, tombstoneLifetime is set to null. When tombstoneLifetime is set to null, the tombstone lifetime defaults to 180 days (hard-coded in the system)

and

In Windows Server 2003 with Service Pack 1 (SP1), Windows Server 2003 with Service Pack 2 (SP2), Windows Server 2008, or Windows Server 2008 R2 operating systems, when tombstoneLifetime is set to null its value defaults to 180 days.

So for now and all eternity, please link to, copy and paste, recite, or whatever you do around this topic from this blog post.

The tombstoneLifetime attribute is very simple. Don’t worry about the operating system as it exists now, don’t worry about the operating system as it existed when the Active Directory was initially built, it is all moot. The one and only way to know what the tombstoneLifetime value for a forest is is to look at it.

  1. If the value of tombstoneLifetime is NULL or <NOT SET> the value *IS* 60 days.
  2. If the value of tombstoneLifetime is > 0. The value *IS* the integer specified measured in days.

You can easily ascertain the value by using the following command: [2]

adfind -config -f objectclass=ntdsservice tombstonelifetime

Which will look like

C:\>adfind -config -f objectclass=ntdsservice tombstonelifetime

AdFind V01.45.00cpp Joe Richards (joe@joeware.net) March 2011

Using server: K8R2Dom-DC1.k8r2dom.loc:389
Directory: Windows Server 2008 R2
Base DN: CN=Configuration,DC=k8r2dom,DC=loc

dn:CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=k8r2dom,DC=loc
>tombstoneLifetime: 180

1 Objects returned

Or if you really want to make this simple, use the following:

adfind -config -f objectclass=ntdsservice tombstonelifetime -oao 60

which will display the integer value no matter what through some AdFind "magic". That magic being that the -oao switch when specified with a value will populate that value in any empty attributes. So if the value isn’t populated in AD, it will still look like it is when the output is displayed.

For example, same command with one non-existent attribute to help illustrate the point:

C:\>adfind -config -f objectclass=ntdsservice tombstonelifetime hardcodedWindowsADTombstoneLifetimeValue -oao 60

AdFind V01.45.00cpp Joe Richards (joe@joeware.net) March 2011

Using server: K8R2Dom-DC1.k8r2dom.loc:389
Directory: Windows Server 2008 R2
Base DN: CN=Configuration,DC=k8r2dom,DC=loc

dn:CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=k8r2dom,DC=loc
>tombstoneLifetime: 180
>hardcodedWindowsADTombstoneLifetimeValue: 60

1 Objects returned

You can do the same with CSV

adfind -config -f objectclass=ntdsservice tombstonelifetime -nodn -csv 60

which could look something like:

C:\>adfind -config -f objectclass=ntdsservice tombstonelifetime hardcodedWindowsADTombstoneLifetimeValue -csv 60 -nodn
"tombstonelifetime","hardcodedWindowsADTombstoneLifetimeValue"
"180","60"

Simple?

In 2017 when this gets screwed up again in TechNet when they are describing how to figure it out with whatever new fancy tool they have now switched to the above information will STILL be correct and that AdFind command will still work just fine.

 

     joe

 

[1] Further proof that PowerShell isn’t doing anything new, it is simply redoing what was done before with more verbose commands… 😉

[2] Or… even shorter  "adfind -b -pr -f objectclass=ntdsservice tombstonelifetime". That can be an exercise for the class to figure out what is happening there. 

Rating 4.00 out of 5

11/20/2011

Target Cleanup of sIDHistory Revisited

by @ 10:53 pm. Filed under tech

I recently had a conversation with an Active Directory engineer who was working on some token bloat issues. As AD has pushed past the decade mark I seem to be seeing/hearing more and more of this bloat problem as many companies continue consolidating groups into and creating new groups in AD without cleanup or normalization.

To be more clear, say a company took whole hog the groups they had before, likely in a couple, but possibly up to hundreds of NT4 domains and collapsed it all into a single forest or they took all of the machine local groups on member servers and sucked them up into AD for “easier management and reporting”. On top of that, all of it has remained with no cleanup and companies moved forward adding more permission and DL groups and merging/consolidating more and more domains (or companies), etc. And then on top of THAT, you get companies who used sIDHistory but never went back and cleaned up what the sIDHistory was initially needed for. What should take place is group/permission normalization, ACL cleanup, etc.

Err ok, I just sidetracked myself with a soapbox speech… back to the AD Engineer patiently waiting for me to shut up and listen to what he wants to accomplish…

So part of the problem this engineer is experiencing is that the Active Directory he is concerned about had been through a double hop AD Consolidation after multiple mergers/acquisitions. I.E. OldOldDomain was migrated/collapsed into OldDomain and later OldDomain was migrated/collapsed into ShinyNewDomain[1]. The migrations involved pulling the objects over whole hog and populating sIDHistory in the new accounts. So what you ended up with was (SIDs shortened for readability):

OldOldDomain – Domain SID S-1-5-12345
OldDomain – Domain SID S-1-5-54321
ShinyNewDomain – Domain SID S-1-5-24680

So a migrated object in ShinyNewDomain has objectSid of S-1-5-24680-2500, and has sIDHistory values of S-1-5-54321-78 and S-1-5-12345-19.

Now let’s say some cleanup had actually occurred and any ACLs with references to SIDs from OldOldDomain were believed to be all gone but there definitely were resources using OldDomain SIDs still. Simple right? Target and remove the OldOldDomain SIDs and leave the OldDomain SIDs in place.

Well unfortunately, the engineer had spoken to another engineer about it and was told it wasn’t possible to perform granular sIDHistory cleanup. He was further told that the process he would have to use to perform this cleanup was to go back to OldDomain, clear the sIDHistory attribute of all objects there, then clear all of the sIDHistory attribute of all matching objects in NewDomain, then re-migrate the SIDs from OldDomain to NewDomain…

I was a bit shocked by this and responded that you could indeed remove individual SIDs from the sIDHistory. And while I don’t know how long it would have taken to perform the other process (assuming OldDomain still existed!), using targeted cleaning of individual SIDs could be done relatively quickly. I would shoot from the hip and say that original process would take a couple of days to get everything all lined up and completed where a granular cleanup could be completed in minutes or hours at most.

I then asked around to some other friends that I know to be good admins, people that aren’t dev guys but generally a big step up from “My name is Peggy”, and a majority of them thought the same thing, it was an all or nothing thing when clearing sIDHistory with one person, who shall remain nameless, actually responding, “Why would you ever want to remove sIDHistory values????” Moving on…

One of the guys sent me a couple of links to MSFT web pages that had VBScript and PowerShell examples and they both removed all values with no indication that you could, if you so desired, remove only a subset of the values. Even a blog entry I had written back in 2006 (http://blog.joeware.net/2006/09/16/621/) only mentioned clearing all values from the attributes on all objects. I did have a later blog post in 2009 (http://blog.joeware.net/2009/06/10/1655/) that explained how to clean up SIDs for a specific domain, looking it over I have to admit it is a bit terse. Plus if you are googling for “sIDHistory cleanup”, the 2009 post doesn’t come up (at least not in the first three pages[2]).

Now I don’t think there is any great conspiracy here, I just think that MSFT didn’t really visualize stacking migrations and thereby stacking up sIDHistory values and I don’t think Google is out to make life hard for AD Admins. That being said, I have now personally seen cases where a single object has 3,4 or even up to 6 sIDHistory values. This is likely unusual for most companies but it is occurring out there and I would hate to think admins in those positions thought they were stuck with keeping all of those entries because they need just one or two of them and can’t find guidance on how to do it.

Granted, if you know enough about the vbscript or the powershell commands or even the AdFind/AdMod commands I used in the 2006 blog you could divine that removal of a single SID from sIDHistory is possible because they all clear the attribute by removing individual values. But low and behold, looking around, I didn’t find it stated anywhere except in my 2009 post and again, that post isn’t popping as early as it could for people. Additionally some people just aren’t all that willing to experiment or don’t have a place to experiment or perhaps even the time to experiment.

So based on the idea that if several smart people I have spoken to don’t know/understand something or, as in this case, have an incorrect understanding of it, I assume that the chances are good that a good number of others don’t know either. This led me to sit down and write this new blog post which will hopefully score higher when you search for “sIDHistory cleanup”. So, if you are still with me, let’s work through the process of “sIDHistory cleanup” in a non-terse manner …

Q: Can you remove a single SID from the sIDHistory attribute of an object? I.E. Can I perform targeted sIDHistory cleanup?

A: ABSOLUTELY! You can indeed remove a single SID or even some subset of SIDs from sIDHistory on an object and in fact complete a targeted sIDHistory cleanup.

Here is a real life example of targeted sidHistory cleanup with AdMod:

C:\temp>adfind -default -f name=$joe sidhistory

AdFind V01.45.00cpp Joe Richards (joe@joeware.net) March 2011

Using server: TEST-DC1.test.loc:389
Directory: Windows Server 2003
Base DN: DC=test,DC=loc

dn:CN=$joe,OU=Users,OU=My,DC=test,DC=loc
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6569
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6570
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6571
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6572

1 Objects returned

C:\temp>admod -b CN=$joe,OU=Users,OU=My,DC=test,DC=loc SID##sidhistory:-:S-1-5-21-3641047700-3957557241-2644433309-6571

AdMod V01.13.00cpp Joe Richards (joe@joeware.net) April 2010

DN Count: 1
Using server: TEST-DC1.test.loc:389
Directory: Windows Server 2003

Modifying specified objects…
   DN: CN=$joe,OU=Users,OU=My,DC=test,DC=loc…

The command completed successfully

C:\temp>adfind -default -f name=$joe sidhistory

AdFind V01.45.00cpp Joe Richards (joe@joeware.net) March 2011

Using server: TEST-DC1.test.loc:389
Directory: Windows Server 2003
Base DN: DC=test,DC=loc

dn:CN=$joe,OU=Users,OU=My,DC=test,DC=loc
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6569
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6570
>sIDHistory: S-1-5-21-3641047700-3957557241-2644433309-6572

1 Objects returned

The key to a targeted sIDHistory cleanup is to specify the actual SID you want removed in the LDAP command. The tricky part of that though is that the SID needs to be specified as a binary SID structure, not the nice friendly string you see above. AdMod is nice in that it allows you to specify the SID## prefix on an attribute to alert AdMod to convert a string SID to a SID structure on your behalf. PowerShell should have something similar (I really don’t know for sure) and vbscript… well you will have to do some digging around on that one. However, to my knowledge, binary structures were never VBScript’s strong point.

Now I did get a follow-up question, “So you can use a wildcard for the SIDs?” I.E. Specify removing any SIDs in sIDHistory that start with the Domain SID of the Domain that is gone? That certainly would be cool but nope, sorry, no such luck. The wildcarding of the SIDs is not possible. If you wanted to clear all of the SIDs from sIDHistory for a specific domain, you would want to dump all sIDHistory values and then filter the strings for the values. This generally just takes a basic string parsing script to perform that filtering for you. Below I walk through some basic steps involved and show how you can quite easily do this with AdFind and AdMod. It is likely that after I post this blog, some PowerShell person somewhere (http://bsonposh.com/) will post a blog on how to do it with PowerShell.

Anyway… now for the interesting stuff…

First… Query the GC with a base of “” for any objects with any value in sIDHistory. Then once that data comes back filter through it for the specific sIDHistory value. Finally mute any records that don’t have any attributes being output (i.e. any objects that don’t have the specified SID listed in sIDHistory).

adfind -gcb -f sidhistory=* sidhistory -mvfilter sidhistory=S-1-5-21-1173133699-2878410131-473346761 -recmute

This generates output like:

AdFind V01.45.00cpp Joe Richards (joe@joeware.net) March 2011

Using server: dc1.sidtest.loc:3268
Directory: Windows Server 2008 R2

dn:CN=group1,OU=TestGroups,DC=sidtest,DC=loc
>sIDHistory: S-1-5-21-1173133699-2878410131-473346761-7912

dn:CN=group2,OU=TestGroups,DC=sidtest,DC=loc
>sIDHistory: S-1-5-21-1173133699-2878410131-473346761-14644

dn:CN=group3,OU=TestGroups,DC=sidtest,DC=loc
>sIDHistory: S-1-5-21-1173133699-2878410131-473346761-15651

dn:CN=group4,OU=TestGroups,DC=sidtest,DC=loc
>sIDHistory: S-1-5-21-1173133699-2878410131-473346761-15662

dn:CN=group5,OU=TestGroups,DC=sidtest,DC=loc
>sIDHistory: S-1-5-21-1173133699-2878410131-473346761-16443

Now visualize hundreds or thousands or tens of thousands of those… You absolutely can parse that by hand if you want but I am lazy, even for five objects so I would go a step further and have AdFind do more of the work by running the following command which is the same as the last but sticks the info into a delimited format using the colon character as the delimiter, oh yeah, don’t output a header…

adfind -gcb -f sidhistory=* sidhistory -mvfilter sidhistory=S-1-5-21-1173133699-2878410131-473346761 -recmute -csv -csvdelim : -nocsvheader

which produces this output

"CN=group1,OU=TestGroups,DC=sidtest,DC=loc":"S-1-5-21-1173133699-2878410131-473346761-7912"
"CN=group2,OU=TestGroups,DC=sidtest,DC=loc":"S-1-5-21-1173133699-2878410131-473346761-14644"
"CN=group3,OU=TestGroups,DC=sidtest,DC=loc":"S-1-5-21-1173133699-2878410131-473346761-15651"
"CN=group4,OU=TestGroups,DC=sidtest,DC=loc":"S-1-5-21-1173133699-2878410131-473346761-15662"
"CN=group5,OU=TestGroups,DC=sidtest,DC=loc":"S-1-5-21-1173133699-2878410131-473346761-16443"

Next you could push that command through a FOR /F loop and generate and write AdMod commands to a text file for your perusal.

C:\qnd\sidtest>for /f "tokens=1,2 delims=:" %i in (‘adfind -gcb -f "sidhistory=*" sidhistory -mvfilter "sidhistory=S-1-5-21-1173133699-2878410131-473346761" -recmute -csv -csvdelim : -nocsvheader’) do @echo admod -b %i SID##sidhistory:-:%j >> SIDHISTORY_CLEANUP.TXT

C:\qnd\sidtest>type SIDHISTORY_CLEANUP.TXT
admod -b "CN=group1,OU=TestGroups,DC=sidtest,DC=loc" SID##sidhistory:-:"S-1-5-21-1173133699-2878410131-473346761-7912"
admod -b "CN=group2,OU=TestGroups,DC=sidtest,DC=loc" SID##sidhistory:-:"S-1-5-21-1173133699-2878410131-473346761-14644"
admod -b "CN=group3,OU=TestGroups,DC=sidtest,DC=loc" SID##sidhistory:-:"S-1-5-21-1173133699-2878410131-473346761-15651"
admod -b "CN=group4,OU=TestGroups,DC=sidtest,DC=loc" SID##sidhistory:-:"S-1-5-21-1173133699-2878410131-473346761-15662"
admod -b "CN=group5,OU=TestGroups,DC=sidtest,DC=loc" SID##sidhistory:-:"S-1-5-21-1173133699-2878410131-473346761-16443"

You can then validate the commands are what you wanted and expected and then batch them to run in phases or through a pilot or run them all at once, just copy the commands to a .CMD file or rename the .TXT file and you are good to go. However… If you just want the commands to directly run you could remove the @echo after the DO and it will execute the commands for you. But in that case… it is simpler to output the information with -ADCSV format and push straight into AdMod like the example in http://blog.joeware.net/2006/09/16/621/

The search command for this case would be adfind -gcb -f "sidhistory=*" sidhistory -mvfilter "sidhistory=S-1-5-21-1173133699-2878410131-473346761" -recmute -adcsv

Which would generate the following output:

~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~~~~ADCSV~~~
"dn","sidhistory"
"CN=group1,OU=TestGroups,DC=sidtest,DC=loc","S-1-5-21-1173133699-2878410131-473346761-7912"
"CN=group2,OU=TestGroups,DC=sidtest,DC=loc","S-1-5-21-1173133699-2878410131-473346761-14644"
"CN=group3,OU=TestGroups,DC=sidtest,DC=loc","S-1-5-21-1173133699-2878410131-473346761-15651"
"CN=group4,OU=TestGroups,DC=sidtest,DC=loc","S-1-5-21-1173133699-2878410131-473346761-15662"
"CN=group5,OU=TestGroups,DC=sidtest,DC=loc","S-1-5-21-1173133699-2878410131-473346761-16443"

The whole command to cleanup would then be

adfind -gcb -f "sidhistory=*" sidhistory -mvfilter "sidhistory=S-1-5-21-1173133699-2878410131-473346761" -recmute -adcsv | admod sidhistory:-:{{sidhistory}} -unsafe

Not bad for 30 seconds worth of “scripting” eh?

joe

[1] Shiny here refers to the Firefly definition and if you don’t know what Firefly is… You have gotten your nerd/geek card revoked. 😉

[2] I have a three page rule with search engines I tend to follow, if it isn’t on the first three pages, I am not likely to see it because I stop looking.

Rating 4.62 out of 5

7/8/2010

Some possibly useful batch commands

by @ 10:31 am. Filed under tech

I had to work out a few things to do in a batch file the last couple of days so I thought I would share. Note: so this doesn’t become a huge powershell versus perl versus whatever discussion, I had no choice, I had batch available period and even that was possibly stretching it a little as the people involved seemed very concerned about scripts, etc. Also, yes I am aware of Tim–Toadie (TIMTOWTDI). So please feel free to comment with additional methods.

 

Getting date and time in a useful format

for /f "tokens=1-4 Delims=/ " %%i in (‘date /t’) do  set dt=%%l/%%j/%%k
for /f "tokens=1" %%i in (‘time /t’) do set tm=%%i
echo Date: %dt%-%tm%

 

Is this machine virtual or physical? It could be VMWare, HyperV or Virtual Server or Virtual PC. I don’t have the strings for other virtualization techs, if people are using them and can post the results of the command “wmic computersystem get model” then they can be added to the batch commands.

set VIRTUAL=NO
set VMWARE=NO
set HYPERV=NO
for /f "skip=2 tokens=1-2 delims=," %%i in (‘wmic computersystem get model /format:csv’) do set MODEL=%%j

: Microsoft Virtualization
if "%MODEL%"=="Virtual Machine" (
  set VIRTUAL=YES
  set HYPERV=YES
)

: VMWare Virtualization
if "%MODEL%"=="VMware Virtual Platform" (
  set VIRTUAL=YES
  set VMWARE=YES
)

 

Is this machine Vista or better?

SET VISTA+=NO
if exist %systemroot%\system32\bcdedit.exe set VISTA+=YES

 

Is this machine x64?

SET x64=NO
if exist "%systemdrive%\program files (x86)" set x64=YES

Rating 4.00 out of 5

4/14/2010

Piping data from AdFind to ExchMbx

by @ 8:10 pm. Filed under tech

I received an email today from someone trying to pipe data from AdFind to ExchMbx. While ExchMbx is getting a little long in the tooth and PowerShell was supposed to have killed it by now since everything is Exchange is supposed to be done via PowerShell now, seems some people are still using it.

Anyway, the issue was a relatively simple one. ExchMbx can accept a quoted DN list via STDIN for input if you want to send it a large quantity of DNs at once. To send that list of DNs via AdFind, you want to use the –dsq option. The –dn option, the –adcsv option, nor the –csv options will not work for this purpose.

However, if you want to get fancy and send in the DNs from a group’s member attribute, you can use something like

adfind –default –f name=groupname member –qlist  exchmbx blah blah

which will give you a quoted DN list that is composed of the membership if the group.

 

    joe

Rating 3.00 out of 5

2/13/2010

AdFind V01.41.00 and AdMod V01.12.00 Released

by @ 2:58 am. Filed under updates

The betrunkener Schmetterling releases of AdFind and AdMod have been posted to the website.

You can find AdFind V01.41.00 here —>  http://www.joeware.net/freetools/tools/adfind/index.htm

You can find the new usage here —> http://www.joeware.net/freetools/tools/adfind/usage.htm

 

You can find AdMod V01.12.00 here —>  http://www.joeware.net/freetools/tools/admod/index.htm

You can find the new usage here —> http://www.joeware.net/freetools/tools/admod/usage.htm

 

You had to expect something was going to hit the joeware free tools website, we are again coming up to The Experts Conference (aka DEC) timeframe and I always try to push something out the door for DEC err TEC. Unfortunately as mentioned earlier, I will not be at TEC this year but I expect a few laptops running my utilities will be there which is almost as good. 🙂

 

I tried something different this time. I worked on updating AdFind and AdMod at the same time. I usually don’t like doing that because my focus can drift but it worked out very well in this case as changes I made to AdFind to get it to compile with Code Gear C++ Builder 2009 were needed for AdMod as well and I also took the opportunity to collapse some of the common functions. Not all of them, lots more can be done in that area but that is for me and not you because it doesn’t do anything for you. For me it means less places to look for changes and a change in one makes the change in both.

 

The AdFind updates that you will notice are mostly pretty small, various bug fixes and some more attributes decoded properly for Windows Server 2008 R2 (thanks to everyone who emails me items that could be decoded or aren’t decoded properly BTW) and a few new switches.

Probably the most “wanted” addition I have added to AdFind are the –tdcfmt and –tdcsfmt switches. These switches allow you to change the output of the time decoding done with the various –tdc* switches. I had lots of people who wanted to set up their own custom time formats and others who wanted me to localize the output. I figured out of the two, allowing someone to set their own format was the more flexible for them and the least amount of work for me. 🙂 So now if you want to output the time like DAY/MONTH/YEAR or even MONTH-YEAR you are welcome to do so. More on that below in the full detailed list of updates.

 

The AdMod updates are a collection of updates made since V01.10.00 was released back in February 2007. I jumped straight to V01.12.00 as I had stopped working on AdMod for some time and just used V01.11.00 myself to work out some really nasty bugs I somehow inserted into it. 🙂 Then when I started working on it again I needed to rev the version number. So no, you didn’t have a black out, V01.11.00 was never publicly available.

There are a ton of changes in AdMod. Its not a major version release but it is definitely two minor releases in terms of bug fixes alone… The first big change is that I converted it to Code Gear C++ Builder 2009 like I did for AdFind. Most folks found tremendous speed increases between the old and new version of AdFind when I switched compilers and I have been seeing the same results with AdMod. Another big change is that AdMod will now encode SDDL strings into Security Descriptors. This is done like encoding GUIDs or SIDs but instead with a prefix of SD#. In the same encoding portion of the code I also added time string encoding as well with UTC##, LOCAL##, and CURRENT##. There are some neat tricks you will be able to pull off with those. One of the final big changes is to allow CSV mode –import switch works in update mode, not just add mode. However, in the interest of data safety, the import mode will NOT overwrite current values, it will only ADD values. So if you have a single valued attribute that is already populated, –import will not overwrite that value. It will bail with an already exists error. If you want that value overwritten, you need to specify the proper attribute operation like description::{{.}} as you did before. I initially set it up with an override switch to allow overwrites, but then saw someone do something that changed my mind.

As always, if you run into issues or just have thoughts, questions, please send me an email. I hope you find the updates to be useful for you. People keep telling me that AdFind/AdMod aren’t needed anymore because PowerShell can do it all but

1) That hasn’t been my experience in any company I have looked at

2) I still get flooded with email requests for new features and how to questions

so I feel the tools are still relevant and useful and will keep them available.

As I mentioned in another blog post, I am considering writing a book on LDAP, AD, ADAM, and AdFind/AdMod and actually started generating a draft table of contents last night while watching Survivor. I think it will be useful and I am, I expect, the best person to write it. 🙂

 

 

ADFIND UPDATE DETAILS

* Lots of bug fixes in logic, switch processing, shortcuts, and the usage.

* Added decodes for

  • linkID
  • msDS-OptionalFeatureFlags
  • msDS-RequiredForestBehaviorVersion
  • msDS-RequiredDomainBehaviorVersion

* Updated some other decoded attributes to include Windows Server 2008 R2

* Did some work on the –e and –ef functionality. These switches enable environment variables or switches from a file to allow you to “hardcode” certain switches into your commands without typing them each time. Also added/updated functionality around a default switch file for each program that is always read in case you have something that you always want done, say like –tdcs or one of the new time formatting switches. Note that the default file is read from the current working directory. This was a purposeful decision.

* Added the following new switches

  • -arecex : this enables A Record Exclusive mode. When you specify a host and this switch together, the underlying API will only look at the A record for the name, it will not try to guess if it is a domain. This can dramatically speed up bind times when you specify a host.
  • -hh : this is a shortcut for –h and –arecex together. I sort of look at –hh as meaning, no I really mean this server name, don’t try to look at domain names.
  • -hd: this was a request from a friend of mine, he wanted a shortcut for –h and –default.
  • -digest : Digest authentication
  • -this : Shortcut for –s base
  • -jtsv : Joe’s TSV mode, sets up a couple of options I often use with in CSV mode
  • -users : Shortcut base to cn=users,<domainDN>
  • -displayspecifiers : Shortcut base to the display specifiers container in the configuration container.
  • -nocsvq : alias for –csvnoq
  • -csvnoheader : alias for nocsvheader
  • -tdcfmt/-tdcsfmt : These allow you to modify the time format output of the various –tdc* switches. Specifically you get to specify the normal time format and the “sortable” time format. The format for each is specified with a string with replaceable parameters.
  • The default format for –tdc is %MM%/%DD%/%YYYY%-%HH%:%mm%:%ss% %TZ%
  • The default format for –tdcs is %YYYY%/%MM%/%DD%-%HH%:%mm%:%ss% %TZ%
  • The parameters are:
  • %MM%    – 2 digit month
  • %DD%    – 2 digit day
  • %YYYY%  – 4 digit year
  • %HH%    – 2 digit hour (24 hour format)
  • %mm%    – 2 digit minute
  • %ss%    – 2 digit second
  • %ms%    – 2 digit millisecond
  • %TZ%    – Time Zone string
  • %%      – Percent symbol

* Added the following shortcuts

  • -sc replstat – Combines several switches to retrieves replication cursors (excluding deleted DSAs) for the configuration NC which can give you a quick view on forest wide replication status.
  • -sc getacl – Combines several switches to get the ACL of a specific object.
  • -sc getacls – Combines several switches to get ACLs on all objects returned.

* Updated the –sc s: and –sc sl: shortcuts to allow you to append ;class or ;attr to focus only on returning classes or attributes.

 

 

ADMOD UPDATE DETAILS

* Converted to CodeGear C++ Builder 2009

* Lots and Lots of bug fixes in logic, switch processing, shortcuts, and the usage.

* Added CSV variable expansion modifiers __lc, __uc, __spec, __hex, __num, *origdn*.

* Added SD## to allow for SDDL encoding to modify Security Descriptors

* Added UTC##, LOCAL##, CURRENT## to allow for int8 time encoding.

* Like with AdFind, worked on the –e and –ef switches and functionality.

* Warn if no redirection is detected and no base is specified.

* Error out if a bad DN is detected in stdin redirection mode.

* Allow non-CSV mode expansion capability. Gives limited variable expansion functionality.

* The –import switch now works with updates as well as adds. Will not overwrite existing values!

* –CSV specified with no arguments enables –import

* Added new switches:

  • -log : Logs AdMod operation info to a file
  • -forestdns : Shortcut Base like in AdFind
  • -domaindns : Shortcut Base like in AdFind
  • -dcs : Shortcut Base like in AdFind
  • -fsps : Shortcut Base like in AdFind
  • -gpo : Shortcut Base like in AdFind
  • -ldappolicy : Shortcut Base like in AdFind
  • -psocontainer : Shortcut Base like in AdFind
  • -xrights : Shortcut Base like in AdFind
  • -partitions : Shortcut Base like in AdFind
  • -sites : Shortcut Base like in AdFind
  • -subnets : Shortcut Base like in AdFind
  • -exch : Shortcut Base like in AdFind
  • -users : Shortcut Base like in AdFind
  • -displayspecifiers : Shortcut Base like in AdFind
  • -stdinadd : Allows you to redirect quoted DNs from STDIN into a multivalue attribute.
  • -stdinrm : Allows you to redirect quoted DNs from STDIN to remove from a multivalue attribute.
  • -stdinreplace : Allows you to redirect quoted DNs from STDIN to replace the values in a multivalue attribute.
  • -csvfile : Read CSV stream from a file
  • -tmpobj : Create an dynamic object (i.e. object with a TTL).
  • -optenc : Alias for –kerbenc
  • -digest : Digest authentication
  • -arecex : this enables A Record Exclusive mode. When you specify a host and this switch together, the underlying API will only look at the A record for the name, it will not try to guess if it is a domain. This can dramatically speed up bind times when you specify a host.
  • -hh : this is a shortcut for –h and –arecex together. I sort of look at –hh as meaning, no I really mean this server name, don’t try to look at domain names.
  • -hd: this was a request from a friend of mine, he wanted a shortcut for –h and –default.
  • digest : Digest authentication

* Added new shortcuts

  • -sc phantomgc : doGarbageCollectionPhantomsNow
  • -sc igcc : invalidateGCConnection
  • -sc rsc : renewServerCertificate
  • -sc rodcpurge : rODCPurgeAccount
  • -sc runpag : runProtectAdminGroupsTask
  • -sc runsamupg : runSamUpgradeTasks
  • -sc rsos : replicateSingleObject – SECRETS_ONLY
Rating 3.00 out of 5

1/6/2010

Nice…

by @ 6:41 pm. Filed under tech

Someone asked me a question at work today about PowerShell… yes, I know, silly silly people but I was a bit curious as well so I opened up the PSompt (hmmm PSPrompt… Command PS… P Prompt… PS Prompt… ) err whatever… I opened the Windows application that gives me an interactive PowerShell instance and typed

help import-csv

That gave me what I needed to answer the question that was asked so I responded to the question and said don’t ask me PowerShell questions every again…

 

After that I noticed in the help where it said “RELATED LINKS” and it specified an online version. I thought that was quite cool, a link to the online assistance for a command right from the command line usage. That seemed very intelligent to me as it gave a location to go for quick help that could be more up to date or more fleshed out, etc. Then I thought, it would be really cool if you could ask for that help right from the command line… So without knowing if it would work or not I typed

help –online import-csv

and sure enough it popped an IE tab with the online help that was more fleshed out than the local usage.

I loved it. Great idea. I have filed that in the back of my head for future tools as well.

Anyway, I give Kudo’s where Kudo’s are due and definitely someone at MSFT who came up with that idea gets a Kudo. 🙂

   joe

Rating 3.00 out of 5

10/1/2009

So I used Serverless Binding with ADSI (or .NET), now what DC am I talking to??

by @ 6:33 pm. Filed under tech

This is something that people occasionally want to do. There are two basic answers that I am aware of. The first I always remember right off since I am an LDAP API coder, is to look at the dnsHostName attribute of the rootdse of the server you are connected to. That is what AdFind and AdMod do when you see the lines

Using server: JOEWARE-DC1.joeware.local:389
Directory: Windows Server 2003

The other way which is ADSI specific and I spent an hour trying to recall today when asked is to use the ADSI GetOption method (IADsObjectOptions::GetOption) to retrieve the ADS_OPTION_SERVERNAME value. I actually have this in an example in my book that lists ACEs in an ACL.

Examples:

VBScript:

Const ADS_OPTION_SERVERNAME=0
‘****************************************************************************
‘Bind to object
‘****************************************************************************
Out "Opening object – " & strLDAPPath
Set objObject = GetObject(strLDAPPath)
strDC = objObject.GetOption(ADS_OPTION_SERVERNAME)

PowerShell (no not me, Brandon gave this to me…)

$dcobject = [adsi]"$Ldap"
$dc = $dcobject.Invoke("GetOption",0)

[ Correction: Quick thanks to Mike for pointing out Brandon’s typo so I could correct it. Brandon obviously meant $dcobject= and not $object= in line 1. He is very sorry to everyone for the typo and he will buy you a cup of coffee the next time he sees you all.  ;o) ]

.NET (again not me, but from a post by Mr. DS.NET programming… Joe Kaplan)

const int ADS_OPTION_SERVERNAME = 0; 
object server = entry.Invoke("GetOption", new object[] {ADS_OPTION_SERVERNAME});

 

  joe

Rating 3.00 out of 5

4/1/2009

Goodbye LDAP… joe enters the exciting field of Cybernetics, Robotics, and Artificial Intelligence Constructs

by @ 1:54 pm. Filed under humour

As some of you were witness at TEC 2009[1], I have put down my work on LDAP (since its a dead protocol and all…) and decided to enter the exciting field of Cybernetics, Robotics, and Artificial Intelligence Constructs. I was secretly testing my latest secret beta of the Tracy-bot artificial intelligence construct while attending TEC 2009.

While the sheer presence of the Tracy-bot in the technical sessions with a bunch of Nerds, Geeks, and other technical folks was enough to cause some folks to guess that it was an artificial construct, others needed to see the Tracy-bot getting drinks and snacks for myself and my friends as well as refusing to take money to go gamble to fully understand it was an artificial device. Still others were just standing around completely unaware and/or confused by the fact that the Tracy-bot was not human.

For those of you who didn’t realize that an artificial product was running around the conference, here is a picture of the secret beta product and possibly you will recall the artificial life form’s presence in several technical sessions at TEC 2009, including the Active Directory ESE (Extensible Storage Engine) session put on by none other than #2 of 6… Brett Shirley up to and including shouting out comments to have the presentation continue so Brett could show off his cool ESE Data Commit in Action Slide.

Tracy-bot with Bwandon

[Tracy-bot with Bwandon]

The Tracy-bot kernel is code complete. The product will not be released until there is a full Software Development Kit for complete customization via Perl scripting as well as many pluggable modules such as the Chess Expert Module, Dungeons and Dragons module, Face Book module, French Maid Module, Catholic School Girl Module, Lawn Mowing Module, Pole Dancing module, Back Scratching Module, as well as the very difficult to produce “Enjoying Watching Science Fiction Shows” module. I have completed several modules but have been having issues with the Sci-Fi shows module as it is still producing crashes and system hangs in the kernel software that result in a snore like sound output as well as unintended hand gestures that result in channel changing.

Please note that neither a .NET Framework interface nor a Power Shell provider will ever be built or supported for the Tracy-bot. The goal is to make sure the Tracy-bot doesn’t become bloated and non-performant and that requires careful programming with native code. The engine is based on the Windows Server 2008 R2 Server Core OS though a fully functional Microsoft Surface GUI not based on any .NET framework components nor Explorer has been produced and is going through intense acceptance testing. Virtual versions of the Tracy-bot are being considered for the Nintendo Wii and iPod Touch.

No requests for beta products will be accepted. This is a closed beta testing program. 🙂

  joe

 

[1] Note that this is NOT my wrap-up on DEC/TEC/Whatever, simply a quick comment on what was going on as I have received some email on the subject and people are concerned that good non-NET based tools will no longer be produced.

Rating 3.00 out of 5

[joeware – never stop exploring… :) is proudly powered by WordPress.]