Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Need help with this script which installs a msi file in all users in the group

Hi,

I am using this...
cscript.exe /nologo "\\indiasophos\Ps\Msi.vbs" title:"Microsoft Office OneNote 2003 Setup" path:"\\indiasophos\Ps\ONOTE11.MSI" group:".net"

Script starts here...

'http://www.vbshf.com/vbshf/forum
'
'Author:
'Rob Dunn  
'
'Email Address:
'uphold2001@hotmail.com
'
'Script Name:
'installmsiapp.vbs
'
'Script Version:
'1.0
'
'Description:
'This script will help you install a particular application based upon user
' membership in a particular domain group.  Installmsiapp will check the
' computer's installed (MSI) applications, see if it can find the requested
' software title, then install the app if it is missing, and if the logged
' in user is a member of the requested domain group (no nested groups currently)
'
'Note that this is for MSI-packaged applications ONLY.
'
'The script will take three inputs as command-line parameters:
'
'title: the application title of the MSI (i.e. "Microsoft .NET Framework 1.1")
'path: the path of the installation MSI (i.e. "\\fileserver\share\netfx.msi)
'group: the name of the domain group (i.e. "Install - .NET")
'
'Note: the group must be a domain group of the currently logged in user domain.
' Also, the name must match EXACTLY (case-insensitive).  If the user is not
' a member of the specified group, the script will exit without checking to see
' if the application is installed or not.  This allows for faster processing.
'
'If the requested application is not installed, a popup dialog will
' appear, telling the user that the application needs to be installed and
' to please wait (this will disappear after 10 seconds (default)).
'
'When the msi installs, it will use the /passive msiexec.exe command-line
' switch, which only shows a progress bar, but no other intervention is
' necessary.
'
'This script is particularly useful for deploying applications via the logon
' script, but you don't want to go the route of deploying via GPO (or if
' perhaps the GPO isn't working properly with a third-party MSI).
'
'An example of this being called from a batch file login script:
'
'cscript.exe /nologo "\\indiasophos\Ps\Msi.vbs" title:"Microsoft Office OneNote 2003 Setup" path:"\\indiasophos\Ps\ONOTE11.MSI" group:".net"
'
'So, in this case, you would create a user group on the domain level called
' 'Install -  .Net 1.1', add users to it, then assign the batch file containing
' the above code to those users...or, you can deploy a GPO with this as a
' logon script, then only give 'Install - .Net 1.1' permissions to apply it
' through the security filtering tab...then assign the GPO to the domain.

'Declare a couple of constants for our WMI connection string (courtesy of
' the Microsoft Scriptomatic 2.0 tool).
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

On Error goto 0

'Declare objects
Set objArgs = WScript.Arguments

'Declare variables
dim bInstalled

'Set to 'false' since we are assuming NOT installed, we will check later...
bInstalled = false

'Show variables as they are being passed, status, etc. -
' 0 = No debug, perform installation
' 1 = Debug, show variables, no installation (don't run MSI at end of script)
iDebug = 0

'Get command-line arguments
If objargs.count < 1 Then
  'If no command line parameters are passed, exit the script.
  wscript.quit
Else

 'Go through all the command-line options and find out what was passed.
 For I = 0 to objArgs.Count - 1
   'Find the title of the application we are looking for.
   If InStr(1,LCase(objargs(I)),"title:") Then
         arrTitle = split(objargs(I),"title:")
         strTitle = arrTitle(1)
         if idebug = 1 then wscript.echo "Title: " & strTitle
       ElseIf InStr(1,LCase(objargs(I)),"path:") Then
    'Find the path of the application down to the .msi extension for the title
    ' we were shown above.
         arrPath = split(lcase(objargs(I)),"path:")
         strPath = arrPath(1)
         if idebug = 1 then wscript.echo "Path: " & strPath
   ElseIf InStr(1,LCase(objargs(I)),"group:") Then
    'What domain group does this user (who is running the script) need to belong
    ' to in order for the .msi to run?
         arrGroup = split(objargs(I),"group:")
         strGroup = arrGroup(1)
         if idebug = 1 then wscript.echo "Group: " & strGroup
   Else
   
   End If
 
 Next
 
End If

'Find out if the currently logged on user is a member of the group we specified
' in strGroup above.  If the user is not a member, then quit the script.
If isMember(strGroup) = false then wscript.quit

'Show text - - if run with cscript.exe, this will show up in the console window
' for the logon script.  If not, it will show up in a pop-up window.
wscript.echo "Verifying install status for " & strTitle

If idebug = 1 then wscript.echo "Is a member of " & strGroup & ": " & IsMember(strGroup)

'Find out if the application we specified is installed - - - i.e. call the
' function that checks the status.
Call CheckInstalledStatus

Function CheckInstalledStatus

'When strComputer = ".", then that means tell the script to check the computer
' which is running the script.

strComputer = "."

   'Create connection via WMI to computer.
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
 
   'Perform a WQL (Windows Query Language) query through the WMI connection
   ' above, and output the results to a collection called 'colItems'.
   Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_Product where caption='" & strTitle & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
   
   'Move through each item in the collection.
   For Each objItem In colItems
   
    'If one of the captions has the text that we specified for the title (i.e.
    ' strTitle, then we know the application is installed.
    If instr(objItem.Caption,strTitle) then
      WScript.Echo objItem.Caption & " is installed.  Continuing script..."
      wscript.echo " "

      'Set this variable to 'true' so we can reference it later.
      bInstalled = true
    End If
   Next

   'If the application is not installed, then install the application...
   If bInstalled = false then
   
      Set WshShell = WScript.CreateObject("WScript.Shell")
     
      'Give the user a warning telling them what is going on.  This will
      ' disappear after 10 seconds.
      WshShell.Popup "Now installing '" & strTitle & "', please stand by, this may take a few minutes..." & vbcrlf & vbcrlf & "This message will disappear in 10 seconds", 10, "Software installation in progress", 64
     
      'Set the command line we are going to run, using the path we specified
      ' in strPath above.  Use the /passive switch so that the user will only
      ' see the progress bar during installation.
      sCmd = "msiexec.exe /i " & chr(34) & strPath & chr(34) & " /passive"
     
      if idebug = 1 then wscript.echo "Command: " & sCmd
      if idebug <> 1 then wshshell.run sCmd,1,true
   Else
      'If the application is installed, then show a quick blurb in the console
      ' window.
      if idebug = 1 then wscript.echo strTitle & " is already installed on this computer."
   End If
   
End Function

'******************************************************************************
'Function IsMember(groupName)
'
'Input: Title of group name you wish to query against.  This will check the
' domain and logged on user ID to find out whether or not it is a member of the
' specified group in 'strGroup' - the title must match the group name exactly.
'******************************************************************************
Private Function IsMember(groupName)
  'Instantiate the network object
  Set netObj = CreateObject("WScript.Network")
 
  'Set variable sDomain to the logged on user's domain.
  sDomain = netObj.UserDomain

  'Set variable sUser to the logged on user's ID.
  sUser = netObj.UserName
 
  'Set is member to false, as if there any problems we want to err on the side
  ' of caution (don't install if we don't know he/she is a member)
  flgIsMember = false
 
  'Attach to the user object in the domain using the WinNT provider.
  Set userObj = GetObject("WinNT://" & sDomain & "/" & sUser & ",user")
 
  'Move through each group that this user is a member of.
  For Each grp In userObj.Groups
   
    'If the name of one of the user's groups match the one we specified then
    ' the user is a member...i.e. flgIsMember = true.
    If grp.Name = groupName Then
    flgIsMember = true
   
    'Don't keep searching, so exit the 'for' loop.
    Exit For
  End If
  Next

'IsMember will equal 'true'/'false', depending on what the code above found.
IsMember = flgIsMember

'Set declared objects to nothing to free up memory.
Set userObj = nothing
Set netObj = nothing

End Function
'*******************************************************************************
Avatar of bsharath
bsharath
Flag of India image

ASKER

I tried doing exactly as setted but dont get the msi installed
Avatar of RobSampson
Sharath, change
iDebug = 0

to
iDebug = 1

then run it again, and see what output you get...it won't actually install the product, but it will tell you the command it would run if it were to install it.

Regards,

Rob.
I get this...

C:\>cscript.exe /nologo "\\Hydsophos\Ps\Msi.vbs" title:"Microsoft Office OneNote
 2003"
Title: Microsoft Office OneNote 2003
Is that all?  No other output?

Rob.
Yes i just get this...
Sharath, I have used a command like this:
cscript /nologo "\\d09790ring\c$\temp\temp\test script\test.vbs" title:"Adobe Reader 7.0.9" path:"\\ntfp\software\Adobe Reader\AdobeRdr709_Extracted\Adobe Reader 7.0.9.msi" group:"IT"

and when executed at a command prompt, I get this:

'==============
Title: Adobe Reader 7.0.9
Path: \\ntfp\software\adobe reader\adoberdr709_extracted\adobe reader 7.0.9.msi
Group: IT
Verifying install status for Adobe Reader 7.0.9
Is a member of IT: True
Adobe Reader 7.0.9 is installed.  Continuing script...

Adobe Reader 7.0.9 is already installed on this computer.
'==============

That's with the
iDebug = 1

Regards,

Rob.
And here's a VBS file that can auto-run it.....

'==========
strVBSFile = "\\d09790ring\c$\temp\temp\test script\Install_Software_To_Group.vbs"
strTitle = "Adobe Reader 7.0.9"
strPath = "\\ntfp\software\Adobe Reader\AdobeRdr709_Extracted\Adobe Reader 7.0.9.msi"
strGroup = "IT"

Set objShell = CreateObject("WScript.Shell")
strCommand = "cscript /nologo """ & strVBSFile & """ title:""" & strTitle & """ path:""" & strPath & """ group:""" & strGroup & """"
'InputBox "Prompt", "Title", strCommand
objShell.Run strCommand, 1, True
'==========

Regards,

Rob.
Rob i just created a Autorun.vbs file with this content...

'==========
strVBSFile = "\\hydsophos\Ps\Msi.vbs"
strTitle = "Microsoft Office OneNote 2003 Setup"
strPath = "\\hydsophos\Ps\ONOTE11.MSI"
strGroup = "Chennai_fs-sg"

Set objShell = CreateObject("WScript.Shell")
strCommand = "cscript /nologo """ & strVBSFile & """ title:""" & strTitle & """ path:""" & strPath & """ group:""" & strGroup & """"
'InputBox "Prompt", "Title", strCommand
objShell.Run strCommand, 1, True
'==========


So what this has to do is Run the script and install the software "OneNote" on all the users that are in the Group "Chennai_fs-sg"

Am i right.
But it just appears and disappears the cmd prompt ...No error....
Should the "Msi.vbs" file be the same as the one i posted.Or should i make any changes.
OK, so we probably need to test it.  Please do the following:
1. Make sure iDebug is set to 1
2. Uncomment the InputBox line in the autorun.vbs
3. Comment out the objShell.Run line in the autorun.vbs
4. Run the autorun.vbs and press CTRL + C when the input box appears, then click OK.
5. Launch a command prompt, and paste the command in there.

This should let you see the output.

Also, just to be clear, this does not install the software to every user in the group, it will only install the software locally, if the user running it is a member of that group.

Regards,

Rob.
Rob i get this...

C:\>cscript /nologo "\\hydsophos\Ps\Msi.vbs" title:"Microsoft Office OneNote 2003 Setup" path:"\\hydsophos\Ps\ONOTE11.MSI" group:"Chennai_fs-sg"
Title: Microsoft Office OneNote 2003 Setup
Path: \\hydsophos\ps\onote11.msi
Group: Chennai_fs-sg
Oh, OK, it quits straight away if you are not a member of that group.....change this line:
If isMember(strGroup) = False Then wscript.quit

to this:
If isMember(strGroup) = False Then
   WScript.Echo "You are not a member of " & strGroup
   wscript.quit
End If

Regards,

Rob.
I am a member Rob..

C:\>cscript /nologo "\\hydsophos\Ps\Msi.vbs" title:"Microsoft Office OneNote 200
3 Setup" path:"\\hydsophos\Ps\ONOTE11.MSI" group:"Chennai_fs-sg"
Title: Microsoft Office OneNote 2003 Setup
Path: \\hydsophos\ps\onote11.msi
Group: Chennai_fs-sg
You are not a member of Chennai_fs-sg

But i get this..

Should the group be any specific as distri or security
OK, try changing this:
If grp.Name = groupName Then

to this:
If LCase(grp.Name) = LCase(groupName) Then

Regards,

Rob.
I get this...

C:\>cscript /nologo "\\hydsophos\Ps\Msi.vbs" title:"Microsoft Office OneNote 200
3 Setup" path:"\\hydsophos\Ps\ONOTE11.MSI" group:"Chennai_fs-sg"
Title: Microsoft Office OneNote 2003 Setup
Path: \\hydsophos\ps\onote11.msi
Group: Chennai_fs-sg
Verifying install status for Microsoft Office OneNote 2003 Setup
Is a member of Chennai_fs-sg: True
OK, after that it should check whether the application is already installed or not....it should say either:
Command: <command to install>

if it's not already installed, or
<Product> is already installed

if it is installed.

If you wait a while, does it do anything else, or in the Task Manager, is wscript.exe still running?

Regards,

Rob.
Rob i get this...

C:\>cscript /nologo "\\hydsophos\Ps\Msi.vbs" title:"Microsoft Office OneNote 200
3 Setup" path:"\\hydsophos\Ps\ONOTE11.MSI" group:"Chennai_fs-sg"
Title: Microsoft Office OneNote 2003 Setup
Path: \\hydsophos\ps\onote11.msi
Group: Chennai_fs-sg
Verifying install status for Microsoft Office OneNote 2003 Setup
Is a member of Chennai_fs-sg: True
Command: msiexec.exe /i "\\hydsophos\ps\onote11.msi" /passive

Then get this box..


---------------------------
Software installation in progress
---------------------------
Now installing 'Microsoft Office OneNote 2003 Setup', please stand by, this may take a few minutes...



This message will disappear in 10 seconds
---------------------------
OK  
---------------------------
Thats it...
When i type this in the run prompt.It just reads it and windows installer window comes and just disappears.
"\\hydsophos\ps\onote11.msi" /passive

What does /passive do?
The /passive switch of MSIExec shows a progress bar only.  No other interface.  Please make sure you have Windows Installer 3.0 though.

Right, so that's good.  Now that it gives you the command it will install with, just change this:
iDebug = 1
to
iDebug = 0

and it will work normally.

Regards,

Rob.
Rob...I just found that one note msi requires cd key may be thats why its not installing..So trying with Microsoft Communicator..

I get this..

C:\>cscript /nologo "\\hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicato
r 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Chennai_fs-sg"
Verifying install status for Microsoft Office Communicator 2005 Setup
\\hydsophos\Ps\Msi.vbs(144, 4) (null): 0x80041010
I think this error is on this line:
If instr(objItem.Caption,strTitle) Then

so above that, can you put:
WScript.Echo "Current caption: " & objItem.Caption

and see how may applications it gets through....

Regards,

Rob.
I still get this...


C:\>cscript /nologo "\\hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicato
r 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Chennai_fs-sg"
Verifying install status for Microsoft Office Communicator 2005 Setup
\\hydsophos\Ps\Msi.vbs(144, 4) (null): 0x80041010
Sharath, I obviously can't find line 144......can you post the full code you are using now? I'll do some testing with it.

Regards,

Rob.
Rob Good Morning...

Here is the whole code..

'http://www.vbshf.com/vbshf/forum
'
'Author:
'Rob Dunn  
'
'Email Address:
'uphold2001@hotmail.com
'
'Script Name:
'installmsiapp.vbs
'
'Script Version:
'1.0
'
'Description:
'This script will help you install a particular application based upon user
' membership in a particular domain group.  Installmsiapp will check the
' computer's installed (MSI) applications, see if it can find the requested
' software title, then install the app if it is missing, and if the logged
' in user is a member of the requested domain group (no nested groups currently)
'
'Note that this is for MSI-packaged applications ONLY.
'
'The script will take three inputs as command-line parameters:
'
'title: the application title of the MSI (i.e. "Microsoft .NET Framework 1.1")
'path: the path of the installation MSI (i.e. "\\fileserver\share\netfx.msi)
'group: the name of the domain group (i.e. "Install - .NET")
'
'Note: the group must be a domain group of the currently logged in user domain.
' Also, the name must match EXACTLY (case-insensitive).  If the user is not
' a member of the specified group, the script will exit without checking to see
' if the application is installed or not.  This allows for faster processing.
'
'If the requested application is not installed, a popup dialog will
' appear, telling the user that the application needs to be installed and
' to please wait (this will disappear after 10 seconds (default)).
'
'When the msi installs, it will use the /passive msiexec.exe command-line
' switch, which only shows a progress bar, but no other intervention is
' necessary.
'
'This script is particularly useful for deploying applications via the logon
' script, but you don't want to go the route of deploying via GPO (or if
' perhaps the GPO isn't working properly with a third-party MSI).
'
'An example of this being called from a batch file login script:
'
'cscript.exe /nologo "\\Hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Onenote"
'
'So, in this case, you would create a user group on the domain level called
' 'Install -  .Net 1.1', add users to it, then assign the batch file containing
' the above code to those users...or, you can deploy a GPO with this as a
' logon script, then only give 'Install - .Net 1.1' permissions to apply it
' through the security filtering tab...then assign the GPO to the domain.

'Declare a couple of constants for our WMI connection string (courtesy of
' the Microsoft Scriptomatic 2.0 tool).
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

On Error goto 0

'Declare objects
Set objArgs = WScript.Arguments

'Declare variables
dim bInstalled

'Set to 'false' since we are assuming NOT installed, we will check later...
bInstalled = false

'Show variables as they are being passed, status, etc. -
' 0 = No debug, perform installation
' 1 = Debug, show variables, no installation (don't run MSI at end of script)
iDebug = 0

'Get command-line arguments
If objargs.count < 1 Then
  'If no command line parameters are passed, exit the script.
  wscript.quit
Else

 'Go through all the command-line options and find out what was passed.
 For I = 0 to objArgs.Count - 1
   'Find the title of the application we are looking for.
   If InStr(1,LCase(objargs(I)),"title:") Then
         arrTitle = split(objargs(I),"title:")
         strTitle = arrTitle(1)
         if idebug = 1 then wscript.echo "Title: " & strTitle
       ElseIf InStr(1,LCase(objargs(I)),"path:") Then
    'Find the path of the application down to the .msi extension for the title
    ' we were shown above.
         arrPath = split(lcase(objargs(I)),"path:")
         strPath = arrPath(1)
         if idebug = 1 then wscript.echo "Path: " & strPath
   ElseIf InStr(1,LCase(objargs(I)),"group:") Then
    'What domain group does this user (who is running the script) need to belong
    ' to in order for the .msi to run?
         arrGroup = split(objargs(I),"group:")
         strGroup = arrGroup(1)
         if idebug = 1 then wscript.echo "Group: " & strGroup
   Else
   
   End If
 
 Next
 
End If

'Find out if the currently logged on user is a member of the group we specified
' in strGroup above.  If the user is not a member, then quit the script.
If isMember(strGroup) = False Then
   WScript.Echo "You are not a member of " & strGroup
   wscript.quit
End If


'Show text - - if run with cscript.exe, this will show up in the console window
' for the logon script.  If not, it will show up in a pop-up window.
wscript.echo "Verifying install status for " & strTitle

If idebug = 1 then wscript.echo "Is a member of " & strGroup & ": " & IsMember(strGroup)

'Find out if the application we specified is installed - - - i.e. call the
' function that checks the status.
Call CheckInstalledStatus

Function CheckInstalledStatus

'When strComputer = ".", then that means tell the script to check the computer
' which is running the script.

strComputer = "."

   'Create connection via WMI to computer.
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
 
   'Perform a WQL (Windows Query Language) query through the WMI connection
   ' above, and output the results to a collection called 'colItems'.
   Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_Product where caption='" & strTitle & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
   
   'Move through each item in the collection.
   For Each objItem In colItems
   
    'If one of the captions has the text that we specified for the title (i.e.
    ' strTitle, then we know the application is installed.
WScript.Echo "Current caption: " & objItem.Caption
    If instr(objItem.Caption,strTitle) then
      WScript.Echo objItem.Caption & " is installed.  Continuing script..."
      wscript.echo " "

      'Set this variable to 'true' so we can reference it later.
      bInstalled = true
    End If
   Next

   'If the application is not installed, then install the application...
   If bInstalled = false then
   
      Set WshShell = WScript.CreateObject("WScript.Shell")
     
      'Give the user a warning telling them what is going on.  This will
      ' disappear after 10 seconds.
      WshShell.Popup "Now installing '" & strTitle & "', please stand by, this may take a few minutes..." & vbcrlf & vbcrlf & "This message will disappear in 10 seconds", 10, "Software installation in progress", 64
     
      'Set the command line we are going to run, using the path we specified
      ' in strPath above.  Use the /passive switch so that the user will only
      ' see the progress bar during installation.
      sCmd = "msiexec.exe /i " & chr(34) & strPath & chr(34) & " /passive"
     
      if idebug = 1 then wscript.echo "Command: " & sCmd
      if idebug <> 1 then wshshell.run sCmd,1,true
   Else
      'If the application is installed, then show a quick blurb in the console
      ' window.
      if idebug = 1 then wscript.echo strTitle & " is already installed on this computer."
   End If
   
End Function

'******************************************************************************
'Function IsMember(groupName)
'
'Input: Title of group name you wish to query against.  This will check the
' domain and logged on user ID to find out whether or not it is a member of the
' specified group in 'strGroup' - the title must match the group name exactly.
'******************************************************************************
Private Function IsMember(groupName)
  'Instantiate the network object
  Set netObj = CreateObject("WScript.Network")
 
  'Set variable sDomain to the logged on user's domain.
  sDomain = netObj.UserDomain

  'Set variable sUser to the logged on user's ID.
  sUser = netObj.UserName
 
  'Set is member to false, as if there any problems we want to err on the side
  ' of caution (don't install if we don't know he/she is a member)
  flgIsMember = false
 
  'Attach to the user object in the domain using the WinNT provider.
  Set userObj = GetObject("WinNT://" & sDomain & "/" & sUser & ",user")
 
  'Move through each group that this user is a member of.
  For Each grp In userObj.Groups
   
    'If the name of one of the user's groups match the one we specified then
    ' the user is a member...i.e. flgIsMember = true.
    If LCase(grp.Name) = LCase(groupName) Then
    flgIsMember = true
   
    'Don't keep searching, so exit the 'for' loop.
    Exit For
  End If
  Next

'IsMember will equal 'true'/'false', depending on what the code above found.
IsMember = flgIsMember

'Set declared objects to nothing to free up memory.
Set userObj = nothing
Set netObj = nothing

End Function
'*******************************************************************************
Rob any help with this

https://www.experts-exchange.com/questions/22916847/Remove-all-users-in-a-file-from-a-specific-group.html

A little urgent requirment to remove the users from a groups.Whose names are in the file..
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent Rob thanks for the help...

One more down and you dont know how much of help you are to me....You have made my job easier...
No problem....you should be pretty good at scripting yourself by now....you've seen enough of them!

But it keeps me learning, so I don't mind!

Regards,

Rob.
Rob i get a box with the content .How can i remove that box without any users interaction.

So i can use this script as logon script.So that who ever are a member of the group will get the software installed automatically.
Sharath, to remove the output, you'll have to change the way you run it a little bit.

You currently run it with something like this:
cscript.exe /nologo "\\Hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Onenote"

So you'll have to run it with wscript instead, like so:
wscript.exe "\\Hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Onenote"

and then also comment out any wscript.echo statements.  Then it should be silent.

Regards,

Rob.
Thanks Rob....Any help with the Q...'s i posted yesterday...
Any help with the posts Rob... :-)
Rob
I need to use this to deploy some softwars to specific user.
I created a group
Put all the users in it.
When used the below code on a non member it gives me the error.
When put the code on a member of the "Office_Deploy" group it installs.
This works great...
But just wanted to know like where should i place this code below.?
To deploy on many users.
Can we use the same script for specific machines

cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy"
Rob
I need to use this to deploy some softwars to specific user.
I created a group
Put all the users in it.
When used the below code on a non member it gives me the error.
When put the code on a member of the "Office_Deploy" group it installs.
This works great...
But just wanted to know like where should i place this code below.?
To deploy on many users.
Can we use the same script for specific machines

cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy"
Do you mean you want to install the program if the user is a member of GroupA OR a member of GroupB?  In that case, change this bit:

'Find out if the currently logged on user is a member of the group we specified
' in strGroup above.  If the user is not a member, then quit the script.
If isMember(strGroup) = False Then
   WScript.Echo "You are not a member of " & strGroup
   wscript.quit
End If



to this:

'Find out if the currently logged on user is a member of the group we specified
' in strGroup above.  If the user is not a member, then quit the script.
arrGroups = Split(strGroup, "|")
boolValid = False
For Each strGroup In arrGroups
      If isMember(strGroup) = True Then
            boolValid = True
      End If
Next
If boolValid = False Then
         WScript.Echo "You are not a member of " & strGroup
         wscript.quit
End If


and then you will be able to run a command such as:
cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance"

notice that the group: part has group names separated by the pipe character.

That should work (in theory.....I haven't tested it).   ;-)

Regards,

Rob.
So does this mean that when i run the code from a machine then all the users in that group will be installed automatically with the software?
Or should i place it in some Group policy.

Can i add machine names in the group instead of users...
The script looks like it's designed to run as a login script, and only to user account types.  It would need to be configured differently to work with computer objects.  In Group Policy, you should be able to put it in as a Login Script.....although it doesn't provide any Administrative privileges, so lower privilege users may not be able to install the MSI.

Rob.
Should i put just this in the login script.
cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance"
Or create a file?
Should i put just this in the login script.
cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance"
Or create a file?
That would probably be best as a quick batch file....just beceause of all of it's parameters and stuff.
Just create a batch file with this in it:

@echo off
cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance"


and then have that batch file in your NetLogon folder on a domain controller, then in the Logon Script part, just put
MyNewBatch.bat

Regards,

Rob.
Thanks for this Rob.Check and works fine...
Thanks for this Rob.Check and works fine...
Rob is there any way to change this to take machine names...
Rob is there any way to change this to take machine names...
I haven't tested this, but see if this version of the script works with a new parameter:
installby, which can be "user" or "computer"

Note that this is still defined by Group Memberships, so make sure your computer objects are in a certain group.

cscript /nologo "\\hyd\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance" installby:"computer

Regards,

Rob.
'Description:
'This script will help you install a particular application based upon user
' membership in a particular domain group.  Installmsiapp will check the
' computer's installed (MSI) applications, see if it can find the requested
' software title, then install the app if it is missing, and if the logged
' in user is a member of the requested domain group (no nested groups currently)
'
'Note that this is for MSI-packaged applications ONLY.
'
'The script will take three inputs as command-line parameters:
'
'title: the application title of the MSI (i.e. "Microsoft .NET Framework 1.1")
'path: the path of the installation MSI (i.e. "\\fileserver\share\netfx.msi)
'group: the name of the domain group (i.e. "Install - .NET")
'installby: the object type to check group membership for. This can
' be computer or user.  If omitted or incorrect, it will default to user.
'
'Note: the group must be a domain group of the currently logged in user domain.
' Also, the name must match EXACTLY (case-insensitive).  If the user is not 
' a member of the specified group, the script will exit without checking to see
' if the application is installed or not.  This allows for faster processing.
'
'If the requested application is not installed, a popup dialog will
' appear, telling the user that the application needs to be installed and 
' to please wait (this will disappear after 10 seconds (default)).
'
'When the msi installs, it will use the /passive msiexec.exe command-line 
' switch, which only shows a progress bar, but no other intervention is 
' necessary.
'
'This script is particularly useful for deploying applications via the logon
' script, but you don't want to go the route of deploying via GPO (or if 
' perhaps the GPO isn't working properly with a third-party MSI).
'
'An example of this being called from a batch file login script:
'
'cscript.exe /nologo "\\Hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance" installby:"User"
'
'So, in this case, you would create a user group on the domain level called
' 'Install -  .Net 1.1', add users to it, then assign the batch file containing
' the above code to those users...or, you can deploy a GPO with this as a 
' logon script, then only give 'Install - .Net 1.1' permissions to apply it
' through the security filtering tab...then assign the GPO to the domain.
 
'Declare a couple of constants for our WMI connection string (courtesy of 
' the Microsoft Scriptomatic 2.0 tool).
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
 
On Error goto 0
 
'Declare objects
Set objArgs = WScript.Arguments
 
'Declare variables
dim bInstalled
 
'Set to 'false' since we are assuming NOT installed, we will check later...
bInstalled = false
 
'Show variables as they are being passed, status, etc. - 
' 0 = No debug, perform installation
' 1 = Debug, show variables, no installation (don't run MSI at end of script)
iDebug = 0
 
' Set default installation group membership checking type
arrInstallBy = "user"
 
'Get command-line arguments
If objargs.count < 1 Then
  'If no command line parameters are passed, exit the script.
  wscript.quit
Else
 
 'Go through all the command-line options and find out what was passed.
 For I = 0 to objArgs.Count - 1
   'Find the title of the application we are looking for.
   If InStr(1,LCase(objargs(I)),"title:") Then
         arrTitle = split(objargs(I),"title:")
         strTitle = arrTitle(1)
         if idebug = 1 then wscript.echo "Title: " & strTitle
       ElseIf InStr(1,LCase(objargs(I)),"path:") Then
    'Find the path of the application down to the .msi extension for the title
    ' we were shown above.
         arrPath = split(lcase(objargs(I)),"path:")
         strPath = arrPath(1)
         if idebug = 1 then wscript.echo "Path: " & strPath
   ElseIf InStr(1,LCase(objargs(I)),"group:") Then
    'What domain group does this user (who is running the script) need to belong
    ' to in order for the .msi to run?
         arrGroup = split(objargs(I),"group:")
         strGroup = arrGroup(1)
         if idebug = 1 then wscript.echo "Group: " & strGroup
   ElseIf InStr(1,LCase(objArgs(I)),"installby:") Then
   		arrInstallBy = split(objargs(I),"installby:")
        strInstallBy = arrInstallBy(1)
   Else
   
   End If
 
 Next 
  
End If
 
'Find out if the currently logged on user is a member of the group we specified
' in strGroup above.  If the user is not a member, then quit the script.
arrGroups = Split(strGroup, "|")
boolValid = False
For Each strGroup In arrGroups
      If isMember(strGroup, strInstallBy) = True Then
            boolValid = True
      End If
Next
If boolValid = False Then
         WScript.Echo "You are not a member of " & strGroup
         wscript.quit
End If
 
 
'Show text - - if run with cscript.exe, this will show up in the console window
' for the logon script.  If not, it will show up in a pop-up window.
wscript.echo "Verifying install status for " & strTitle
 
If idebug = 1 then wscript.echo "Is a member of " & strGroup & ": " & IsMember(strGroup)
 
'Find out if the application we specified is installed - - - i.e. call the 
' function that checks the status.
Call CheckInstalledStatus
 
Function CheckInstalledStatus
 
'When strComputer = ".", then that means tell the script to check the computer
' which is running the script.
 
strComputer = "."
 
   'Create connection via WMI to computer.
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
  
   'Perform a WQL (Windows Query Language) query through the WMI connection
   ' above, and output the results to a collection called 'colItems'.
   Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_Product where caption='" & strTitle & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
   
   'Move through each item in the collection.
   On Error Resume Next
   For Each objItem In colItems
         If Err.Number = 0 Then
               On Error GoTo 0
         
          'If one of the captions has the text that we specified for the title (i.e.
          ' strTitle, then we know the application is installed.
      WScript.Echo "Current caption: " & objItem.Caption
          If instr(objItem.Caption,strTitle) then 
            WScript.Echo objItem.Caption & " is installed.  Continuing script..."
            wscript.echo " "
      
            'Set this variable to 'true' so we can reference it later.
            bInstalled = true
          End If
       Else
          Err.Clear
          On Error GoTo 0
       End If
   Next
 
   'If the application is not installed, then install the application...
   If bInstalled = false then
   
      Set WshShell = WScript.CreateObject("WScript.Shell")
      
      'Give the user a warning telling them what is going on.  This will 
      ' disappear after 10 seconds.
      WshShell.Popup "Now installing '" & strTitle & "', please stand by, this may take a few minutes..." & vbcrlf & vbcrlf & "This message will disappear in 10 seconds", 10, "Software installation in progress", 64
      
      'Set the command line we are going to run, using the path we specified
      ' in strPath above.  Use the /passive switch so that the user will only
      ' see the progress bar during installation.
      sCmd = "msiexec.exe /i " & chr(34) & strPath & chr(34) & " /passive"
      
      if idebug = 1 then wscript.echo "Command: " & sCmd
      if idebug <> 1 then wshshell.run sCmd,1,true 
   Else
      'If the application is installed, then show a quick blurb in the console
      ' window.
      if idebug = 1 then wscript.echo strTitle & " is already installed on this computer."
   End If
   
End Function
 
'******************************************************************************
'Function IsMember(groupName)
'
'Input: Title of group name you wish to query against.  This will check the 
' domain and logged on user ID to find out whether or not it is a member of the 
' specified group in 'strGroup' - the title must match the group name exactly.
'******************************************************************************
Private Function IsMember(groupName, strObjectType)
  'Instantiate the network object
  Set netObj = CreateObject("WScript.Network")
  
  'Set variable sDomain to the logged on user's domain.
  sDomain = netObj.UserDomain
 
  If LCase(strObjectType) = "computer" Then
      sUser = netObj.ComputerName & "$"
  Else
	  'Set variable sUser to the logged on user's ID.
	  sUser = netObj.UserName
	  strObjectType = "user"
  End If
  
  'Set is member to false, as if there any problems we want to err on the side
  ' of caution (don't install if we don't know he/she is a member)
  flgIsMember = false
  
  'Attach to the user object in the domain using the WinNT provider.
  Set userObj = GetObject("WinNT://" & sDomain & "/" & sUser & "," & strObjectType)
  
  'Move through each group that this user is a member of.
  For Each grp In userObj.Groups
    
    'If the name of one of the user's groups match the one we specified then
    ' the user is a member...i.e. flgIsMember = true.
    If LCase(grp.Name) = LCase(groupName) Then
    flgIsMember = true
    
    'Don't keep searching, so exit the 'for' loop.
    Exit For
  End If
  Next
 
'IsMember will equal 'true'/'false', depending on what the code above found.
IsMember = flgIsMember
 
'Set declared objects to nothing to free up memory.
Set userObj = nothing
Set netObj = nothing
 
End Function
'*******************************************************************************

Open in new window

Rob thanks .I will check on this...Can this be changed to install Msp files instead of MSI.?
As office 2007 does not have a Msi file.
And i need to do it with MSP.
I need to install this on 1200+ systems and before this month end . :-(
Any other ideas are also welcom.
If yes i shall post a new question...For further discussion...
Yes, in theory we should be able to change this:
sCmd = "msiexec.exe /i " & chr(34) & strPath & chr(34) & " /passive"

to this:
strParentPath = Left(strPath, InStrRev(strPath, "\") - 1)
sCmd = chr(34) & strParentPath & "setup.exe" & chr(34) & " /adminfile " & chr(34) & strPath & chr(34)

Regards,

Rob.
I added the computers inside the group and ran the bat file.It says you are not a member.Any views...
I added the computers inside the group and ran the bat file.It says you are not a member.Any views...
Rob by mistake i left away a "".
Now i get this.
\\hyd\Ps\Msi_for_computers.vbs(217, 3) (null): The network path was not found.
Rob by mistake i left away a "".
Now i get this.
\\hyd\Ps\Msi_for_computers.vbs(217, 3) (null): The network path was not found.
I'll have to do some testing later....I am unable to at the moment because I'm still in training.....
For the new error you get....was that when you changed the sCmd line?  Just reverse that for now...

Rob.
Ok Rob... There are some posts that are easy i bet for you...Please have a look

Here was the change

C:\>cscript /nologo "\\hyd\Ps\Msi_for_computers.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy installby:"computer
You are not a member of

When i assed the "" as below gor the error.
C:\>cscript /nologo "\\hyd\Ps\Msi_for_computers.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy" installby:"computer
\\hyd\Ps\Msi_for_computers.vbs(217, 3) (null): The network path was not fo
und.

Ok Rob... There are some posts that are easy i bet for you...Please have a look

Here was the change

C:\>cscript /nologo "\\hyd\Ps\Msi_for_computers.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy installby:"computer
You are not a member of

When i assed the "" as below gor the error.
C:\>cscript /nologo "\\hyd\Ps\Msi_for_computers.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hyd\Ps\Communicator.msi" group:"Office_deploy" installby:"computer
\\hyd\Ps\Msi_for_computers.vbs(217, 3) (null): The network path was not fo
und.

I have done some testing, for MSI files, this should be OK....

You can run this to install by computer membership:
cscript /nologo "test2.vbs" title:"Adobe Reader 7.0.9" path:"\\ntfp\software\Adobe Reader\AdobeRdr709_Extracted\Adobe Reader 7.0.9.msi" group:"TestGroup" installby:"computer"

or change the last parameter to "computer" to install by user membership:
cscript /nologo "test2.vbs" title:"Adobe Reader 7.0.9" path:"\\ntfp\software\Adobe Reader\AdobeRdr709_Extracted\Adobe Reader 7.0.9.msi" group:"TestGroup" installby:"user"

Regards,

Rob.
'Description:
'This script will help you install a particular application based upon user
' membership in a particular domain group.  Installmsiapp will check the
' computer's installed (MSI) applications, see if it can find the requested
' software title, then install the app if it is missing, and if the logged
' in user is a member of the requested domain group (no nested groups currently)
'
'Note that this is for MSI-packaged applications ONLY.
'
'The script will take three inputs as command-line parameters:
'
'title: the application title of the MSI (i.e. "Microsoft .NET Framework 1.1")
'path: the path of the installation MSI (i.e. "\\fileserver\share\netfx.msi)
'group: the name of the domain group (i.e. "Install - .NET")
'installby: the object type to check group membership for. This can
' be computer or user.  If omitted or incorrect, it will default to user.
'
'Note: the group must be a domain group of the currently logged in user domain.
' Also, the name must match EXACTLY (case-insensitive).  If the user is not 
' a member of the specified group, the script will exit without checking to see
' if the application is installed or not.  This allows for faster processing.
'
'If the requested application is not installed, a popup dialog will
' appear, telling the user that the application needs to be installed and 
' to please wait (this will disappear after 10 seconds (default)).
'
'When the msi installs, it will use the /passive msiexec.exe command-line 
' switch, which only shows a progress bar, but no other intervention is 
' necessary.
'
'This script is particularly useful for deploying applications via the logon
' script, but you don't want to go the route of deploying via GPO (or if 
' perhaps the GPO isn't working properly with a third-party MSI).
'
'An example of this being called from a batch file login script:
'
'cscript.exe /nologo "\\Hydsophos\Ps\Msi.vbs" title:"Microsoft Office Communicator 2005 Setup" path:"\\hydsophos\Ps\Communicator.msi" group:"Office_deploy|IT Members|Finance" installby:"User"
'
'So, in this case, you would create a user group on the domain level called
' 'Install -  .Net 1.1', add users to it, then assign the batch file containing
' the above code to those users...or, you can deploy a GPO with this as a 
' logon script, then only give 'Install - .Net 1.1' permissions to apply it
' through the security filtering tab...then assign the GPO to the domain.
 
'Declare a couple of constants for our WMI connection string (courtesy of 
' the Microsoft Scriptomatic 2.0 tool).
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
 
On Error goto 0
 
'Declare objects
Set objArgs = WScript.Arguments
 
'Declare variables
dim bInstalled
 
'Set to 'false' since we are assuming NOT installed, we will check later...
bInstalled = false
 
'Show variables as they are being passed, status, etc. - 
' 0 = No debug, perform installation
' 1 = Debug, show variables, no installation (don't run MSI at end of script)
iDebug = 0
 
' Set default installation group membership checking type
arrInstallBy = "user"
 
'Get command-line arguments
If objargs.count < 1 Then
  'If no command line parameters are passed, exit the script.
  wscript.quit
Else
 
 'Go through all the command-line options and find out what was passed.
 For I = 0 to objArgs.Count - 1
   'Find the title of the application we are looking for.
   If InStr(1,LCase(objargs(I)),"title:") Then
         arrTitle = split(objargs(I),"title:")
         strTitle = arrTitle(1)
         if idebug = 1 then wscript.echo "Title: " & strTitle
       ElseIf InStr(1,LCase(objargs(I)),"path:") Then
    'Find the path of the application down to the .msi extension for the title
    ' we were shown above.
         arrPath = split(lcase(objargs(I)),"path:")
         strPath = arrPath(1)
         if idebug = 1 then wscript.echo "Path: " & strPath
   ElseIf InStr(1,LCase(objargs(I)),"group:") Then
    'What domain group does this user (who is running the script) need to belong
    ' to in order for the .msi to run?
         arrGroup = split(objargs(I),"group:")
         strGroup = arrGroup(1)
         if idebug = 1 then wscript.echo "Group: " & strGroup
   ElseIf InStr(1,LCase(objArgs(I)),"installby:") Then
   		arrInstallBy = split(objargs(I),"installby:")
        strInstallBy = arrInstallBy(1)
   Else
   
   End If
 
 Next 
  
End If
 
'Find out if the currently logged on user is a member of the group we specified
' in strGroup above.  If the user is not a member, then quit the script.
arrGroups = Split(strGroup, "|")
boolValid = False
For Each strGroup In arrGroups
      If isMember(strGroup, strInstallBy) = True Then
            boolValid = True
            strValidGroup = strGroup
      End If
Next
If boolValid = False Then
         WScript.Echo "You are not a member of " & Join(arrGroups, ", ")
         wscript.quit
End If
 
 
'Show text - - if run with cscript.exe, this will show up in the console window
' for the logon script.  If not, it will show up in a pop-up window.
wscript.echo "Verifying install status for " & strTitle
 
If idebug = 1 then wscript.echo "Is a member of " & strValidGroup
 
'Find out if the application we specified is installed - - - i.e. call the 
' function that checks the status.
Call CheckInstalledStatus
 
Function CheckInstalledStatus
 
'When strComputer = ".", then that means tell the script to check the computer
' which is running the script.
 
strComputer = "."
 
   'Create connection via WMI to computer.
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
  
   'Perform a WQL (Windows Query Language) query through the WMI connection
   ' above, and output the results to a collection called 'colItems'.
   Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_Product where caption='" & strTitle & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
   
   'Move through each item in the collection.
   On Error Resume Next
   For Each objItem In colItems
         If Err.Number = 0 Then
               On Error GoTo 0
         
          'If one of the captions has the text that we specified for the title (i.e.
          ' strTitle, then we know the application is installed.
      WScript.Echo "Current caption: " & objItem.Caption
          If instr(objItem.Caption,strTitle) then 
            WScript.Echo objItem.Caption & " is installed.  Continuing script..."
            wscript.echo " "
      
            'Set this variable to 'true' so we can reference it later.
            bInstalled = true
          End If
       Else
          Err.Clear
          On Error GoTo 0
       End If
   Next
 
   'If the application is not installed, then install the application...
   If bInstalled = false then
   
      Set WshShell = WScript.CreateObject("WScript.Shell")
      
      'Give the user a warning telling them what is going on.  This will 
      ' disappear after 10 seconds.
      WshShell.Popup "Now installing '" & strTitle & "', please stand by, this may take a few minutes..." & vbcrlf & vbcrlf & "This message will disappear in 10 seconds", 10, "Software installation in progress", 64
      
      'Set the command line we are going to run, using the path we specified
      ' in strPath above.  Use the /passive switch so that the user will only
      ' see the progress bar during installation.
      sCmd = "msiexec.exe /i " & chr(34) & strPath & chr(34) & " /passive"
      
      If idebug = 1 then wscript.echo "Command: " & sCmd
      if idebug <> 1 then wshshell.run sCmd,1,true 
   Else
      'If the application is installed, then show a quick blurb in the console
      ' window.
      if idebug = 1 then wscript.echo strTitle & " is already installed on this computer."
   End If
   
End Function
 
'******************************************************************************
'Function IsMember(groupName)
'
'Input: Title of group name you wish to query against.  This will check the 
' domain and logged on user ID to find out whether or not it is a member of the 
' specified group in 'strGroup' - the title must match the group name exactly.
'******************************************************************************
Private Function IsMember(groupName, strObjectType)
  'Instantiate the network object
  Set objADSys = CreateObject("ADSystemInfo")
  If LCase(strObjectType) = "computer" Then
  	sUser = "LDAP://" & objADSys.ComputerName
  Else
  	sUser = "LDAP://" & objADSys.UserName
  End If
  
  'Attach to the user object in the domain using the LDAP provider.
  If idebug = 1 then wscript.echo "Connecting to: " & sUser
  Set objMember = GetObject(sUser)
  
  'Set is member to false, as if there any problems we want to err on the side
  ' of caution (don't install if we don't know he/she is a member)
  flgIsMember = false
 
  For Each grp In objMember.Groups
  	'If idebug = 1 then wscript.echo "Currently a member of: " & grp.Name
    If LCase(Mid(grp.Name, 4)) = LCase(groupName) Then
    	flgIsMember = True    
    	'Don't keep searching, so exit the 'for' loop.
    	Exit For
    End If
  Next
  
'IsMember will equal 'true'/'false', depending on what the code above found.
IsMember = flgIsMember
 
'Set declared objects to nothing to free up memory.
Set objMember = nothing
Set objADSys = nothing
 
End Function
'*******************************************************************************

Open in new window

Thanks Rob shall check this.
At present my ADS admin is working on the machine for some issue.

Any help with some excel macro's?
Are you done with your training?
Thanks Rob shall check this.
At present my ADS admin is working on the machine for some issue.

Any help with some excel macro's?
Are you done with your training?
Yes, we have finished our training.  I will look at some of your other macros...

Rob.