Archive for December, 2006

VBScript - Check if current user is a member of a certain group

I found some code to do this out on the net the other day. I’ve modified it a little, and added the part that checks environment variables.

It probably isn’t too efficient, as it creates a new object and then kills it every time the function is called, but it’s fine for my purposes.

‘Error Handling
On Error Resume Next

‘Calls the isMember function with the specified group to see if the current user
‘ is a member of that group.
If isMember(”TypeGroupNameHere”) = “False” Then
       ‘do something
    Else
       ‘do something else
End If

‘ *****************************************************
‘This function checks to see if the passed group name contains the current
‘ user as a member. Returns True or False
Function IsMember(groupName)
    If IsEmpty(groupListD) then
        Set groupListD = CreateObject(”Scripting.Dictionary”)
        groupListD.CompareMode = TextCompare
        ADSPath = EnvString(”userdomain”) & “/” & EnvString(”username”)
        Set userPath = GetObject(”WinNT://” & ADSPath & “,user”)
        For Each listGroup in userPath.Groups
            groupListD.Add listGroup.Name, “-”
        Next
    End if
    IsMember = CBool(groupListD.Exists(groupName))
End Function
‘ *****************************************************

‘ *****************************************************
‘This function returns a particular environment variable’s value.
‘ for example, if you use EnvString(”username”), it would return
‘ the value of %username%.
Function EnvString(variable)
    set objShell = WScript.CreateObject( “WScript.Shell” )
    variable = “%” & variable & “%”
    EnvString = objShell.ExpandEnvironmentStrings(variable)    
    Set objShell = Nothing    
End Function
‘ *****************************************************

Share/Save/Bookmark

A quick shortcut to “Offer Remote Assistance”

Paste the following into the Start, Run dialog box. It allows you to offer remote assistance to other PCs in your domain.

hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Unsolicited/Unsolicitedrcui.htm

Share/Save/Bookmark

KnowledgebasePublisher

If you’re looking for an open-source Knowledge Base, look no further than KnowledgebasePublisher.

v2.0 beta 1 has just been released. I’ve upgraded my 1.5.1 version to 2.0b1 without any issues. The additions are exactly what I was after, as I migrated to KBP from ASPKB which already supported attachments and related articles.

Here are the changes since 1.5.2 as per the project web site (complete with spelling errors):

  • Attachments support
  • Related articles support
  • RSS feeds support
  • Quick responce (when user fills “Contact Us” form)
  • “Contact Us” data saved in DB, later it could be easily copied to KB
  • Email Templates (all email templates could be easily customized)
  • Email Settings such as mailer, sendmail, smtp etc. now could be managed in settings section
  • Improved, more flexible and usable “Settings” + more setting values
  • Meta keywords, description for article
  • CategoryID removed from KB links, now article could be safely moved between categories (old links are valid)

At the moment, all that I feel is lacking from KBP is LDAP integration.

If you need a knowledge base, here is the perfect (and open-source) solution.

Share/Save/Bookmark