writing values in to excel

N

Nuti

Hi,

I have got a script which gets all the groups associated with a
particular user.
im able to refer the user name from the excel.
How can i write groups names (multiple values) in to excel.

*************code************************
Set Wshshell = wscript.createobject("Wscript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oGroupDict = CreateObject("Scripting.Dictionary")
'set fso = createobject("scripting.filesystemobject")

Set excelapp = CreateObject ("excel.application")
Set openexcel =excelapp.workbooks.open ("mypath\groups1.xls")
k=2
While openexcel.worksheets(1).range("A"&k).value <> ""
strusername= openexcel.Worksheets(1).Range("A"&k)
wscript.echo strusername
PopulateGroups(strUserName)
k=k+1
Wend




'---------------Function to populate the user's domain membership
-------------'
' The group name is passed as an arguement '
'------------------------------------------------------------------------------'
Function PopulateGroups(userName)
Dim sAdsPath, oUser, oGroup
If IsEmpty(DomainGroupsForUser) Then
Set DomainGroupsForUser = CreateObject("Scripting.Dictionary")
DomainGroupsForUser.CompareMode = vbTextCompare
sAdsPath = WshNetwork.UserDomain & "/" & userName
Set oUser = GetObject("WinNT://" & sAdsPath & ",user")
For Each oGroup In oUser.Groups

DomainGroupsForUser.Add oGroup.Name, "-"
wscript.echo oGroup.Name

Next
Set oUser = Nothing
End If
End Function


'---------------Function to check if the user is a member of the
group---------'
' The group name is passed as an arguement '
'------------------------------------------------------------------------------'
Function IsMember(sGroup)
isMember = CBool(DomainGroupsForUser.Exists(sGroup))
End Function
 
Top