News

 Subscribe Add to Technorati Favorites

 

 

 

 


 

 

Search My Blog:

 

 

My Stats

  • Posts - 472
  • Comments - 275
  • Trackbacks - 265

Twitter












Tag Cloud


Recent Comments


Recent Posts


Archives


Post Categories


Blogs


Miscellanous


Noteworthy Stuff


Popular Posts


December 2006 Entries

nunit testing 32-bit apps on 64-bit machine


I'm trying to run nunit tests of a 32-bit assembly on a 64-bit machine. When I load the assembly (compiled with VS target platform set to x86) into nunit, I get a FileNotFound exception. The problem is that nunit is running as 64-bit. I found this post by Matevz Gacnik pointing me in the right direction to get around this problem. Here is the fix:

You can use corflags to find out what settings the nunit assembly already has:

C:\> corflags "C:\Program Files (x86)\NUnit-Net-2.0 2.2.9\bin\nunit-console.exe"

Then you can add the 32BIT flag to force it to run as 32-bit:

C:\> corflags "C:\Program Files (x86)\NUnit-Net-2.0 2.2.9\bin\nunit-console.exe" /32BIT+

See also:
CorFlags Conversion Tool at MSDN,
Explanation of CLR, platform selection, and corflags.

Technorati : , , ,

posted @ Thursday, December 28, 2006 9:57 AM | Feedback (1) |


Change Active Directory password with NetCmdlets


Here's how you can change your active directory (or other ldap server) password with the set-ldap cmdlet in /n software NetCmdlets. Also, recently I also showed how to this using the IP*Works! SSL LdapS dev component.

PS C:\> set-ldap -server myserver -binddn Domain\Administrator -password admin -dn "cn=BillyBob,ou=Employees,dc=DOMAIN" -newpassword mynewpassword -ssl implicit

Update: the -password parameter is now a secure string.  There is also a -credential parameter.  So the cmd to change the password is now either:

  1. PS C:\> set-ldap -server testboy -cred $mycred -dn "CN=Lance Robinson,CN=Users,DC=JUNGLE" -newpassword  lancer -ssl implicit

    or:
  2. PS C:\tools> set-ldap -server testboy -binddn JUNGLE\Administrator -password $password -dn "CN=Lance Robinson,CN=Users,DC=JUNGLE" -newpassword lancer -ssl implicit

    where $password is a secure-string, ie: $password = read-host -assecurestring

Technorati : , , , , , , ,

posted @ Wednesday, December 27, 2006 1:33 PM | Feedback (0) |


NetCmdlets support PSCredentials


Previously with NetCmdlets, authentication details were only accepted using plain text parameters. This is still supported, but now these cmdlets support PSCredentials through a new -credentials parameter. This works for almost all of the cmdlets included in NetCmdlets, like FTP, LDAP, HTTP, SMTP, Rexec, RSS, IM, SMS, SSH, etc.

Here's an example with get-ldap. Before, you had to bind to the directory server using plain text parameters, like this:

PS C:\> get-ldap -server testboy -binddn mydomain\admin -pass admin

Now you can also bind like this:

PS C:\> get-ldap -server testboy -cred $mycreds

This does become problematic if you're trying to authenticate with a full DN to a server like Novell or OpenLDAP that may not support compact user DN aliases. There is a way around this; I just posted this in the PowerShell newsgroup:

Tom G. wrote:
> Lance,

> The NetCmdlets are pretty cool. However, I'm having some trouble
> authenticating. I need to pass in a username in the format of
> "cn=userid,o=orgname,c=US". The credential parameter in get-ldap doesn't
> seem to support this. Any suggestions?

Just for the benefit of anyone else who was trying this: Tom and I
have exchanged emails, but for the benefit of anyone else who was
interested:

get-ldap and set-ldap allow you to provide authentication info to the
cmdlet in two ways: 1: through dn and password parameters, or 2:
through a credential parameter that takes a standard PSCredential
object.

The problem with using the credential method was that if you were a non
Active Directory user, and you didn't have an alias like MyDomain\Lance
to authenticate with, the get-credentials pop-up dialog wouldn't accept
your full DN (ie, cn=LRobinson,ou=Employees,dc=NS) as valid input.

Tom pointed out the "ConsolePrompting" registry string value ("True")
in HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\, which tells
get-credentials to take its input from the console instead of the
pop-up dialog. Doing it this way allows you to specify a full DN as
the username.

To bind to the directory server using a credential obtained in this way:

PS> $mycred = get-credential -credential "cn=Lance,ou=Employees,dc=NS"
...
PS> get-ldap -server testboy -cred $mycred

To bind and then search for a user (BillyBob) in the Employees
organizational unit:

PS> get-ldap -server testboy -cred $mycred -dn "ou=Employees,dc=NS"
-search "cn=BillyBob"

To bind, perform the same search, and return all attributes of the
user:

PS> get-ldap -server testboy -cred $mycred -dn "ou=Employees,dc=NS"
-search "cn=BillyBob" -attr

Technorati : , , , , , ,

posted @ Wednesday, December 27, 2006 1:27 PM | Feedback (1) |


NetCmdlets Part 3: PowerShell and Active Directory using /n software's LDAP cmdlet


MOW's "PowerShelled" blog is another awesome PowerShell resource. Of particular interest to me was MOWs series on PowerShell and Active Directory. He used the .Net System.DirectoryServices classes to do all the work.

here is how you can use /n software's LDAP cmdlet to manage directory servers like AD.

  1. The LDAP cmdlet supports plain connections as well as secure SSL connections.
  2. The LDAP cmdlet will work with any directory server, including AD, ADAM, OpenLDAP, Novell, etc.
  3. The LDAP cmdlet uses its own implementation of LDAP that has been developer tested for years, because it is built on top of the IPWorks SSL LDAPS component. So...there is no need to create an instance of System.DirectoryServices.DirectoryEntry.

First, to just test the connection the my directory server:

PS C:\ $root = get-ldap -server testboy -binddn dc=mydomain
PS C:\ $root

Host : testboy
DN : dc=mydomain
Successful : True

Instead of just binding anonymously, I can bind as a particular user (like admin):

PS C:\ $root = get-ldap -server testboy -binddn mydomain\admin -pass admin
PS C:\ $root

Host : testboy
DN : mydomain\administrator
Successful : True

Now I will search. I can specify a separate dn on which to perform the search (or I could also search using the dn that I've bound as), and the filter that I want to search for (-search). Here's a search of just the root node, which returns an array.

PS C:\ get-ldap -server testboy -binddn mydomain\admin -pass admin -dn dc=mydomain -search objectClass=*

Host DN Type Value
testboy CN=Builtin,DC=MYDOMAIN System.String[] System.String[]
testboy CN=Computers,DC=MYDOMAIN System.String[] System.String[]
testboy OU=Domain Controllers,DC=MYDOMAIN System.String[] System.String[]
testboy OU=Employees,DC=MYDOMAIN System.String[] System.String[]
testboy CN=ForeignSecurityPrincipals,DC=MYDOMAIN System.String[] System.String[]
testboy CN=Infrastructure,DC=MYDOMAIN System.String[] System.String[]
testboy OU=LancesUnit,DC=MYDOMAIN System.String[] System.String[]
testboy CN=LostAndFound,DC=MYDOMAIN System.String[] System.String[]
testboy CN=Microsoft Exchange System Objects,DC=MYDOMAIN System.String[] System.String[]
testboy CN=NTDS Quotas,DC=MYDOMAIN System.String[] System.String[]
testboy CN=Program Data,DC=MYDOMAIN System.String[] System.String[]
testboy CN=System,DC=MYDOMAIN System.String[] System.String[]
testboy CN=Users,DC=MYDOMAIN System.String[] System.String[]


I can access a particular node of the array just as any other:

PS C:\ (get-ldap -server testboy -binddn mydomain\admin -pass admin -dn dc=mydomain -search objectClass=*)[6]

Host DN Type Value
testboy OU=LancesUnit,DC=MYDOMAIN System.String[] System.String[]


What if I want to see all the attributes of this node? I can just add an -attr parameter:

PS C:\ (get-ldap -server testboy -binddn mydomain\admin -pass admin -dn dc=mydomain -search objectClass=* -attr $true)[6]

objectClass : {top, organizationalUnit}
ou : {LancesUnit}
distinguishedName : {OU=LancesUnit,DC=mydomain}
instanceType : {4}
whenCreated : {20051122214101.0Z}
whenChanged : {20051122214101.0Z}
uSNCreated : {382126}
uSNChanged : {382126}
name : {LancesUnit}
objectGUID : {?§'?Ùâ%GŸœÝš6w|¢}
objectCategory : {CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=mydomain, }
Host : testboy
DN : OU=LancesUnit,DC=mydomain


Get a list of employees:
PS C:\ get-ldap -server testboy -binddn DOMAIN\admin -pass admin -dn "ou=Employees,dc=DOMAIN" -search objectClass=*

To find a particular employee:
get-ldap -binddn DOMAIN\administrator -password admin -server testboy -dn ou=Employees,dc=DOMAIN -search cn=LRobinson

To get the attributes of a particular employee:
get-ldap -binddn DOMAIN\administrator -password admin -server testboy -dn ou=Employees,dc=DOMAIN -search cn=LRobinson -attr $true

Technorati : , , , , , ,

posted @ Wednesday, December 27, 2006 1:25 PM | Feedback (0) |


AmzWish featured at Widgetbox


AmzWish is currently one of the featured widgets at Widgetbox.

AmzWish is a widget (developed with RSSBus) that displays your Amazon wishlist (or wedding/baby registry). Visitors can click on items from your wishlist and purchase them for you, and Amazon will ship them directly to you.

Technorati : , , , , ,

posted @ Thursday, December 21, 2006 9:18 AM | Feedback (0) |


Nerd controversy: Ninja Turtles versus Renaissance artists


Today's xkcd.

(01:43) jamesn: I disagree with the Ninja Turtle one. I think Raphael is much more recognizable as a turtle

(01:43) lancer: haha

(01:45) lancer: michelangelo would have to be the most recognizable as an artist

(01:46) jamesn: no way

(01:46) jamesn: Leonardo


Technorati :

posted @ Friday, December 15, 2006 4:03 PM | Feedback (3) |


quickly add zip and credit card functionality to applications


James Shaw mentioned how easy it was to add zip and credit card functionality (using nsoftware components) to a recent website he helped build recently.

Technorati : , , ,

posted @ Friday, December 15, 2006 4:01 PM | Feedback (2) |


NetCmdlets FTP - recursive directory upload


ckj asked me how to "recursively upload a directory mutiple levels deep via send-ftp". Here is my answer:

For now, the send-ftp cmdlet allows you to upload one file at a time (its a beta). But you can easily use get-children's recursive flag to get a list of all the files to upload, and call send-ftp for each one. Here is a little script to do so.


param( [string] $dir = "C:\Testing\FTPTest\" )

$files = (get-childitem $dir -r)
foreach ($file in $files) {
$remfilename = $file.FullName.Replace($dir, "")
$remfilename = $remfilename.Replace("\", "/")
if ($file.Attributes -eq "Directory") {
send-ftp -server MYSERVER -user TEST -password TEST -create $remfilename
}
else {
send-ftp -server MYSERVER -user TEST -password TEST -localfile $file.FullName -remotefile $remfilename
}
Write-Host $remfilename
}

Technorati : , , ,

posted @ Thursday, December 07, 2006 11:37 AM | Feedback (2) |