Results 1 to 3 of 3
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Detect which version of Windows is running

    Click image for larger version. 
<br /><script async src=
    Name: WinVersion.jpg  Views: 15  Size: 75.0 KB  ID: 10528" class="thumbnail" style="float:CONFIG" />


    The code above bombs on the "Set CN = GetObject("LDAP://" & ADSI.ComputerName)"

    What am I missing? OR, is there a simple way to distinguish between XP and Win 7? [I need to shell to an app that's either in Program Files or Program Files (x86)] I know I can just look for the directory, but the question of Windows version holds some added interest.

    Thanks,
    Bill

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have Win XP Pro/ Access 2000

    I entered in your code and it doesn't bomb for me. It returns:

    "Windows XP Professional
    5.1 (2600)"

    I added this "& vbCrLf & CN.operatingsystemservicepack" to the OSInfo = line and it returns

    "Service Pack 3"


    Here is the code I used:
    Code:
    Option Compare Database
    Option Explicit
    
    Sub MyVer()
       MsgBox OSInfo
    End Sub
    
    Public Function OSInfo() As String
       Dim ADSI As Object, CN As Object
    
       Set ADSI = CreateObject("ADSystemInfo")
       Set CN = GetObject("LDAP://" & ADSI.computername)
       OSInfo = CN.operatingsystem & vbCrLf & CN.operatingsystemversion & vbCrLf & CN.operatingsystemservicepack
    
       Set CN = Nothing
       Set ADSI = Nothing
    
    End Function
    I removed all of the references I could and it still wouldn't bomb...




    EDIT:
    Re-read your error message. I am on a domain, but I am a full administrator.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks Steve, but I still can't get by the offending statement:

    Set CN = GetObject("LDAP://" & ADSI.computername)

    Bill

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 05-30-2012, 07:00 AM
  2. Replies: 12
    Last Post: 02-09-2012, 02:27 PM
  3. Replies: 5
    Last Post: 01-18-2012, 12:46 PM
  4. maketable running without message windows
    By afshin in forum Queries
    Replies: 2
    Last Post: 01-10-2012, 04:44 AM
  5. Replies: 3
    Last Post: 07-15-2010, 05:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums