Archive for November 2010

Courion Tip–LDIF file creation pt 2

Here’s a snippet of code I used to determine the correct name of the group for a user to be added to….
' What Group to join
GroupName = InputBox("Enter PART of the group name that the user needs to be a member of")
REM WScript.Echo("User will be a member of : "&GroupName)
strSQLQuery = "select distinct groupname from staging_oidgroups where groupname like "&"'"&groupname&"'"
REM wscript.echo strSQLQuery
Set objRS = objCN.Execute(strSQLQuery)

And here’s what you should format your *.ldif file to look like:
dn: cn=group name goes here,cn=groups,dc=company name,dc=com
changetype: modify
add: UniqueMember
uniquemember: cn=users common name,cn=users,dc=company name,dc=com

Posted November 29, 2010 by mmdmurphy in Courion Tip

Courion Tip–other users for SQL table: LDIF file creation

The company I work for haven’t yet integrated LDAP account creation into our Courion system. We just haven’t gotten to it yet, but as both a stopgap solution and as a mental exercise, it occurred to me that I could create an *.ldif file from the information in the Courion Database that we use. And that I could probably automate the ldap add process. So, the code below is what I have come up with.

I am working on a modification to this to allow selection of the ldap groups that the user should be made a member of, and will post that later.

Note that I have done a search and replace for all information that might be considered a security risk, or could provide too much information about where I work. Therefore, let me say up front that this worked before I did the search and replace, and I hope it works for you (or at least provides enough information to get you started).

The key steps are to get an *.ldif file to model yours after, and the SQL query commands – note that this runs in a trusted mode – meaning that YOU have rights to access the data…

The usual warnings about copy and pasting from a website apply – the lines probably end in the wrong place, and the quotation marks are probably mangled.

 
'==========================================================================
'
' NAME: LDIF from Courion Profile.vbs
'
'
'==========================================================================
Option Explicit
'On Error Resume Next

Dim objFSO, objFolder, objFile,objShell, DocumentPath, WshShell, network, newuser, SN, GivenName, EmailAddress, Work_Order_Number
Dim LDIF_File, CMD_File, objTextFile, UserObj, tempstring, DateTime

' OpenTextFile Method needs a Const value
' ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForAppending = 8
Const ForWriting = 2

' ==================================================
' Prepare TimeStamp
' ==================================================
DateTime=Year(Now)
If len(Month(Now))=1 Then
DateTime=DateTime&"0"
End If

DateTime=DateTime&Month(Now)
If len(Day(Now))=1 Then
DateTime=DateTime&"0"
End If

DateTime=DateTime&Day(Now)
If len(Hour(Now))=1 Then
DateTime=DateTime&"0"
End If

DateTime=DateTime&Hour(Now)
If len(Minute(Now))=1 Then
DateTime=DateTime&"0"
End If

DateTime=DateTime&Minute(Now)
If len(Second(Now))=1 Then
DateTime=DateTime&"0"
End If

DateTime=DateTime&Second(Now)& "z"

' un comment next line for debugging
'wscript.echo datetime

 

'=============================================
' where to store the files.
Set WshShell = Wscript.CreateObject("Wscript.Shell")
DocumentPath=WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal")
' un comment next line for debugging
'    WScript.Echo(DocumentPath)
DocumentPath = DocumentPath+"\Work_Order\"

' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(DocumentPath) Then
Set objFolder = objFSO.GetFolder(DocumentPath)
'   WScript.Echo DocumentPath & " already created "
Else
Set objFolder = objFSO.CreateFolder(DocumentPath)
WScript.Echo "Just created " & DocumentPath
End If

If err.number = vbEmpty then
Set objShell = CreateObject("WScript.Shell")
Else WScript.echo "VBScript Error: " & err.number
End If

'=============================================
' Prompt for Work_Order_Number
Work_Order_Number = InputBox("Enter the Work_Order_Number for this request")
Work_Order_Number = Trim(Work_Order_Number)
'    WScript.Echo("Processing Work_Order_Number"&Work_Order_Number)

'=============================================
' What user ID
newuser = InputBox("Enter the USER ID that needs added to LDIF_SYSTEM")
newuser = Trim(newuser)
newuser = UCase(newuser)
'    WScript.Echo(newuser)
If Len(newuser)<>7 Then
WScript.Echo("bad user name {wrong length}, exiting")
WScript.Quit()
Else
REM        WScript.Echo("Processing username: "&newuser)
End If

 

REM http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=771
REM Some of the commented out lines below are from this article. I left
REM Them in for reference...
Dim objCN, strConnection
Set objCN = CreateObject("ADODB.Connection")

REM strConnection = "Driver={SQL Server};Server=TRINITY;Database=NorthWind;Trusted_Connection=TRUE"
strConnection = "Driver={SQL Server};Server=SQL_Server_Name;Database=Courion_Database;Trusted_Connection=TRUE"

objCN.Open strConnection

Dim strSQLQuery
strSQLQuery = "Select * from Profile where Profileuid = "&"'"&newuser&"'"
REM     wscript.echo strSQLQuery

'"SELECT * FROM Users"

Dim objRS
Set objRS=CreateObject("ADODB.Recordset")

Set objRS = objCN.Execute(strSQLQuery)

Do Until objRS.EOF
'access columns using objRS("column")
'    WScript.Echo objRS.Fields("ProfileUID") & vbTab & objRS.Fields("Email")
'    WScript.Echo objRS.Fields("ProfileUID").value
GivenName=objRS.Fields("Firstname").value
sn=objRS.Fields("Lastname").value
EmailAddress=objRS.Fields("Email").value
'objRS.Fields("Name") & " [" & Trim(objRS.Fields("SAM")) & "]" & vbTab & objRS.Fields("computer")
objRS.MoveNext
Loop
objRS.Close

objCN.Close

REM Display the information on screen so that we can verify the accuracy..

Wscript.Echo("========== Please verify ==========" _
& vbCrLf & "Work_Order_Number: "&Work_Order_Number _
& vbCrLf & "User Name (profileuid): "&newuser _
& vbCrLf & "First Name (given name): "&GivenName _
& vbCrLf & "Sir Name (last name): "&sn _
& vbCrLf & "Email Address: "&EmailAddress)

'=============================================
' Create the File System Object *.ldif
' Note that this does create a default password, which we do NOT provide to the end user
' we have a "new Target password" workflow to handle this.
LDIF_File = DocumentPath& Work_Order_Number & "_LDIF_SYSTEM_" & newuser & ".LDIF"
Set objFSO = nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(LDIF_File)
Set objFile = nothing
Set objFile = objFSO.OpenTextFile(LDIF_File, ForAppending, True)
objFile.WriteLine("dn: cn="&newuser&",cn=users,dc=location,dc=Company_Name,dc=com")
objFile.WriteLine("userpassword: {MD4}zQdsgmg+io632432ewAR/fMg==")
objFile.WriteLine("orclpassword: {x- orcldbpwd}1.0:EF0324235CFB45A506B44")
objFile.WriteLine("mail: "&EmailAddress)
objFile.WriteLine("uid:"&newuser)
objFile.WriteLine("objectclass: top")
objFile.WriteLine("objectclass: person")
objFile.WriteLine("objectclass: inetorgperson")
objFile.WriteLine("objectclass: organizationalperson")
objFile.WriteLine("objectclass: orcluser")
objFile.WriteLine("objectclass: orcluserv2")
objFile.WriteLine("orclisenabled: ENABLED")
objFile.WriteLine("orclactivestartdate: "&DateTime)
objFile.WriteLine("sn: "&sn)
objFile.WriteLine("GivenName: "&GivenName)
objFile.WriteLine("cn: "&newuser)
objFile.Close

'=============================================
' The following code is up to you to deciede. This creates a *.cmd file
' with a hard coded reference to IBM's ldap software (available on the internet on IBM's site)
' You need to choose to use it or not, I cannot vouch for the licensing.
' In addition, you may not want to create this, but instead use a tool like softera ldap admin to import the file.
' Create the File System Object *.cmd
CMD_File = DocumentPath& Work_Order_Number & "_LDIF_SYSTEM_" & newuser & ".cmd"
Set objFSO = nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(CMD_File)
Set objFile = nothing
Set objFile = objFSO.OpenTextFile(CMD_File, ForAppending, True)

tempstring ="cd "&"""C:\Program Files\IBM\LDAP\V6.2\bin\"""
' wscript.echo tempstring
objFile.WriteLine(tempstring)
tempstring = "ldapadd -h LDIF_SYSTEM -p 389 -D cn=ADMIN_USER,cn=Users,dc=location,dc=Company_Name,dc=com -w ADMIN_PASSWORD -v -f "
tempstring = tempstring & CHR(34) & LDIF_File & CHR(34)
wscript.echo tempstring
objFile.WriteLine(tempstring)
objFile.WriteLine("pause")
objFile.WriteLine("exit")
objFile.Close

'=============================================
'Open up location where *.cmd file was created
If err.number = vbEmpty Then
Set objShell = CreateObject("WScript.Shell")
objShell.run ("Explorer" &" " & DocumentPath)
Else WScript.echo "VBScript Error: " & err.number
End If

WScript.Quit

Posted November 26, 2010 by mmdmurphy in Courion Tip

iOS 4.2 ate my Playlist

I upgraded my iPad to iOS 4.2 today. I have a smart playlist on my PC called “unplayed podcasts”. On the PC, it shows 4 items. On the iPad, it shows none. Rebuilt the smart playlist, same thing.

—- Just a few additional notes…

I have recreated this several times, but to no avail. The basic query is

Meet all the following criteria:
PlayCount is 0 (I have also tried Playcount is less than 2)
Any of the following criteria:
MediaKind is Podcast
Genre is Podcast

This shows (since I refreshed the podcasts) 8 items on the computer.
I did a sync to my iPad and iPod, and now both show NO items in the playlist on those devices.

I read somewhere (forgot where, sorry!) that maybe having a SONG in the playlist would resolve it. So, I modified it to (under any of the following….) Artist is Adrian Belew. That shows 14 items on the computer, and, after synching, 0 items on the iPad.

I will probably live with it instead of reverting back to the old iOS….. and HOPE that iOS 4.21 fixes it.

————–
I did do a reboot of the computer, and of the iPad… No change. I MIGHT do a complete reset of the iPad (back to ground zero) and see if that helps. Will post later if it does…

————–
Well, my iPod started doing it as well, so I did a complete reset (restore to factory defaults) on it, and …. well, 2 things. I kept clicking on the “check for updates” every few weeks, and it never said an update was available. So, as soon as I told it to restore to factory settings, it downloaded an update. JERKS. Anyway, the reset seems to have solved it on the iPod.

The other thing is that my iPad now shows 4.2.1, not 4.2 – when did this happen? Anyway time to bite the bullet and do the restore. Wish me luck.
————–
Well, that was a waste of time. complete restore on iPad did NOT resolve this issue
————–
11/23/2010 – Still not resolved. I tried this (below) and it did not work for me. Might work for you…
http://downloadsquad.switched.com/2010/11/23/how-to-get-back-missing-music-after-updating-to-ios-4-2/
————–
11/29/2010 – Still not resolved.

Posted November 22, 2010 by mmdmurphy in ipod, tips

Tagged with

Changing KIA Headlight

I will tell you 2 methods…. By the way, I did notice the pictures got clipped in the view, however, you really ought to click on them and open them “full size” in a new window.

By the way, several people told me not to touch the bulb – shortens the life of the bulb.

Method 1 – If you DON’T know what you are doing, remove the headlight / headlamp assembly. On my 2004, it was pretty obvious. 2 10 mm bolts, unplug everything, pull forward. Use screw driver to get over the dings and stuff that happened over the years. Wipe it down and carry it inside. Change headlight in comfort.

Method 2 –

  • If you DO know what you are doing. Unscrew the big rubber … what? Weather prevention thing. It goes less than 1/4 turn, and then removes easily. If you are fighting with it, you are doing it wrong and should use the other method.
  • Unplug the headlight by pulling the plug towards the back of the car. Again, it should come out pretty easily.
  • Unlatch the metal clip that is hold in the headlamp. And this is where it gets tricky and why I have included photos. The instructions on the internet said “pull it towards you”… I have NO idea what that means. At this point, I have my feet under the car, and am leaning over the hood. So, “ME” covers about 270 degrees. Here’s my version….
    • Do this in the daylight. It’s too hard to see at night.
    • Look at the clip that holds it in. There’s a short one, which ends in near the middle of the bulb. Ignore this one, other than noting it’s there. And then there’s the longer one. This longer one is held in place by a metal tooth and by spring action, and is on the other side of the bulb from the short one. You need to push it a little bit towards the front of the car, and slide it away from the middle of the bulb. As soon as you get it over that tooth (see the photos I plan on including), the whole metal clip thing will swing out of the way.
    • Put the other bulb in, and reverse the action  – rotate the clip like it was on a hinge, and then push it towards the bottom and front of the car until you get the metal clip over the tooth.

IF YOU BREAK THE METAL CLIP THING, your KIA dealer will try to sell you a new headlamp assembly. Be prepared to spend the afternoon bending one from a coat hanger instead.

Changing KIA headlight 1

Changing KIA headlight 4

Changing KIA headlight 6

Posted November 19, 2010 by mmdmurphy in KIA, tips

Converting videos to play on iPad

I had some training videos that I wanted to play on my iPad, which were in *.wmv format.
I tried several programs to convert them so they would play on my iPad, and after converting all the files, I synched my iPad. In EVERY case, iTunes said – basically – not copying to iPad cos your iPad won’t play them.

I finally found Videora iPad Converter, and was able to convert them AND when I plugged in my iPad, it copied them from itunes to my iPad without complaint.

One thing I didn’t like so much is the queueing feature – which only shows up after you change the user interface to “advanced”  (and the ‘in application” ads)

Posted November 13, 2010 by mmdmurphy in freeware, Video

Tagged with ,

Courion Tip – Multiple New Targets and Ticketing information

You must know ahead of time that the workflows are supposed to have the same targets. And I am only talking about password resets, but the key is knowing that the workflows we are touching have the same targets.

  • Whenever you add a new target, and you update your targetting info, save yourself grief and do it in alphabetical order.
  • Simply do a copy (and I DO mean “Control-C”) of the Target Status on your ticketing settings, go to the workflow you are updating, and do a paste “Control V”
  • That simple? Yes. I am completely stunned how long a text string is stored in the copy/paste buffer – I probably have more targets than you, and have never had an issue. BUT, please verify this yourself – do a password change using the workflow you just modified and a test account that has accounts on every target & then verify your ticketing information.

One “gotcha” that we ran across – sometimes you do this, and in your ticketing table, you’ll start seeing “%PMM Gateway…..Native Status%” {that’s from memory, so it may not be exactly right, but you will know when you see it} type entries for the target status. Well, pay attention to those. That is tell you – first of all – that you have fewer targets for that workflow than you did in the one you copied from. I said up front that you have to know that they have the same targets. Secondly, it tells you which target is missing! It’s right in there, just after the Gateway…

Posted November 13, 2010 by mmdmurphy in Courion Tip

Tagged with

Courion Tip – Adding New Multiple Targets to Multiple Workflows Quickly

So, here’s the scenario. You have to add 50 targets to your password change workflows. Someone once said, “If you want to find the most efficient way to do something, give it to a lazy person”. You want to do this as quickly as possible. In our case, we have 3 production servers – two that the end users actually use for password resets (behind a load balancer) and one that I use to add new targets, workflows prior to impacting the end user.
For now, lets talk about that third server only….
We have 6 password related workflows… my boss said I can post about courion, as long as I don’t provide any information about our actual network. So, let’s pretend our workflows are called:

    I’m New Here
    Try it again
    Change it myself
    Reset it myself
    control alt delete
    I got a new target

Next concern – and this is pretty much THE critical part – You need to know what the unique resource data on these workflows is like. What do I mean? Well, after having worked with ours for several years now, I know that the unique resource data for “I’m New Here”, “Change it myself”, “Reset it myself” and “I got a new target” workflows is identical. “Try it again” and “control alt delete” have different unique resource data settings.
So, time to sit in front of the keyboard…

  1. “Best Practice” tip – archive your configuration before you start. Depending on what I am doing, I sometimes manually copy the cfgfile.db. You can (should) also make a copy of your workflow inside the courion admin tool itself. To do this, I create a new workflow by copying an existing workflow – but I put the letter “z” in front (so it sorts to the bottom). So, I would now have a “zI’m New Here” workflow.
  2. While you are in there, you might as well go ahead and make copies of the other workflows – better safe than sorry!
  3. You HAVE to manually add all the targets (Global settings, target configuration) and the unique resource data (Actions, Password Reset, … Unique resource data) to one of the workflows. Again, I chose the “I’m New Here” workflow. Test it.
  4. Now use the Migration Utility – BUT… when it comes to selecting what to export, export ONLY the global settings  / target configuration / PMM Gateway and the Password Reset / Unique Resource data / PMM Gateway. NO OTHER part of the workflow. Save this off to a file, let’s call it temp.xml. Close out the Migration Utility
  5. Now make a copy of the temp.xml (let’s call it “Change it myself”) edit it in a text editor (and make sure it saves it just as text – in other words, do NOT use Microsoft Word. I personally use “UltraEdit” or “Notepad++”
  6. Now, do a search and replace – search for “I’m New Here” (ie, the name of the workflow you did the export from) and replace with “Change it myself” (ie, the name of the workflow you want to add these targets to. You have to get the names EXACTLY right.
  7. Save the file.
  8. Now go into the Migration Utility, and import the *.xml file you just edited. During the import process, I prefer to select ONLY the global settings  / target configuration / PMM Gateway and the Password Reset / Unique Resource data / PMM Gateway. NO OTHER part of the workflow. Yes, if that’s all you exported, that’s all that will be there to import – BUT, if you, uh, “messed up” that during the export, here’s the chance to redeem yourself and not ruin your workflow. So, click on the little “+” signs and make sure….
  9. Complete the import, and then you will need to update your ticketing configuration – I have procedures here, but I will tell you about that as a separate post.
  10. TEST TEST TEST. Your “Change it Myself” workflow now as at least the same number of targets (and they should work!) as your “I’m New Here” workflow. Why? Well, it overlays the stuff you import, it doesn’t replace the entire workflow. And that’s why I say “at least the same number of targets” – if your “Change it Myself” workflow has some that the “I’m New Here” doesn’t – it will still have them.
  11. What about the other workflows, where the unique resource data is different? Well, you can do the same sort of thing, EXCEPT export only the Global Settings/ Target Configuration, do the search and replace, and then import just that part. You’ll still have to do the Unique Resource Data – but (and I think this alone is worth doing it this way) you will be sure you have those targets in the other workflow. Our company has several hundred connections & it is cumbersome to make sure each workflow has all the targets (for workflows that should have all the targets, of course!)
  12. I make a backup copy on the other production boxes, using that create new workflow / copy from / prepend with the letter z method before I import.
  13. Now do your “regular” export import to get the updated workflows onto the other servers. I usually only do 2 at a time, but that’s up to you.

Posted November 13, 2010 by mmdmurphy in Courion Tip

Tagged with