jeffmacl
Posts: 2
Score: 0 Joined: 6/4/2008 Status: offline
|
I am new to vb and need help with a script. This appears to work except it does not get the sid information. I'm not sure what to change to get it. Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add intRow = 2 objExcel.Cells(1, 1).Value = "AccountExpirationDate" objExcel.Cells(1, 2).Value = "BadPasswordAttempts" objExcel.Cells(1, 3).Value = "Description" objExcel.Cells(1, 4).Value = "FullName" objExcel.Cells(1, 5).Value = "HomeDirDrive" objExcel.Cells(1, 6).Value = "HomeDirectory" objExcel.Cells(1, 7).Value = "LastLogin" objExcel.Cells(1, 8).Value = "LastLogoff" objExcel.Cells(1, 9).Value = "LoginHours" objExcel.Cells(1, 10).Value = "LoginScript" objExcel.Cells(1, 11).Value = "LoginWorkstations" objExcel.Cells(1, 12).Value = "MaxLogins" objExcel.Cells(1, 13).Value = "MaxPasswordAge" objExcel.Cells(1, 14).Value = "MaxStorage" objExcel.Cells(1, 15).Value = "MinPasswordAge" objExcel.Cells(1, 16).Value = "MinPasswordLength" objExcel.Cells(1, 17).Value = "Name" objExcel.Cells(1, 18).Value = "objectSid" objExcel.Cells(1, 19).Value = "Parameters" objExcel.Cells(1, 20).Value = "PasswordAge" objExcel.Cells(1, 21).Value = "PasswordExpired" objExcel.Cells(1, 22).Value = "PasswordHistoryLength" objExcel.Cells(1, 23).Value = "PrimaryGroupID" objExcel.Cells(1, 24).Value = "Profile" objExcel.Cells(1, 25).Value = "UserFlags" On Error Resume Next Set Fso = CreateObject("Scripting.FileSystemObject") strDomainName = InputBox("Enter Domain Name To Query") Set objDomain = GetObject("WinNT://" & strDomainName) objDomain.Filter = Array("user") For Each objItem in objDomain objExcel.Cells(intRow, 1).Value = objItem.AccountExpirationDate objExcel.Cells(intRow, 2).Value = objItem.BadPasswordAttempts objExcel.Cells(intRow, 3).Value = objItem.Description objExcel.Cells(intRow, 4).Value = objItem.FullName objExcel.Cells(intRow, 5).Value = objItem.HomeDirDrive objExcel.Cells(intRow, 6).Value = objItem.HomeDirectory objExcel.Cells(intRow, 7).Value = objItem.LastLogin objExcel.Cells(intRow, 8).Value = objItem.LastLogoff objExcel.Cells(intRow, 9).Value = objItem.LoginHours objExcel.Cells(intRow, 10).Value = objItem.LoginScript objExcel.Cells(intRow, 11).Value = objItem.LoginWorkstations objExcel.Cells(intRow, 12).Value = objItem.MaxLogins objExcel.Cells(intRow, 13).Value = objItem.MaxPasswordAge objExcel.Cells(intRow, 14).Value = objItem.MaxStorage objExcel.Cells(intRow, 15).Value = objItem.MinPasswordAge objExcel.Cells(intRow, 16).Value = objItem.MinPasswordLength objExcel.Cells(intRow, 17).Value = objItem.Name objExcel.Cells(intRow, 18).Value = objItem.objectSid objExcel.Cells(intRow, 19).Value = objItem.Parameters objExcel.Cells(intRow, 20).Value = objItem.PasswordAge objExcel.Cells(intRow, 21).Value = objItem.PasswordExpired objExcel.Cells(intRow, 22).Value = objItem.PasswordHistoryLength objExcel.Cells(intRow, 23).Value = objItem.PrimaryGroupID objExcel.Cells(intRow, 24).Value = objItem.Profile objExcel.Cells(intRow, 25).Value = objItem.UserFlags intRow = intRow + 1 Next Set objDomain = Nothing objExcel.Range("A1:Y1").Select objExcel.Selection.Interior.ColorIndex = 19 objExcel.Selection.Font.ColorIndex = 11 objExcel.Selection.Font.Bold = True objExcel.Cells.EntireColumn.AutoFit
|