6Foot2 Posted March 9, 2012 Posted March 9, 2012 Link: Automatically fill the computer description field in Active Directory - 4sysops We have it working here: http://img42.imageshack.us/img42/8176/autopupulatead.jpg [Computer names, usernames and station serial numbers removed from this view] The next time we have a damaged computer and we want to find out who logged on last All I have to do is look at Active Directory. Perhaps this script could be modified to include free disk space and system RAM? Set WshNetwork = WScript.CreateObject("WScript.Network")Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") ' get service tag and computer manufacturer For Each objSMBIOS in objWMI.ExecQuery("Select * from Win32_SystemEnclosure") serviceTag = replace(objSMBIOS.SerialNumber, ",", ".") manufacturer = replace(objSMBIOS.Manufacturer, ",", ".") Next ' get computer model For Each objComputer in objWMI.ExecQuery("Select * from Win32_ComputerSystem") model = trim(replace(objComputer.Model, ",", ".")) Next ' get computer object in AD Set objSysInfo = CreateObject("ADSystemInfo") Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName) ' build up description field data and save into computer object objComputer.Description = WshNetwork.UserName & " (" & serviceTag & " - " & manufacturer & " " & model & ")" objComputer.SetInfo 3
sted Posted March 9, 2012 Posted March 9, 2012 try this Option Explicit On Error Resume Next Dim objRootDSE, objNetwork, objWMIService, objComputer Dim strComputer, strMake, strModel, strSerialNumber, strMacAddresses, strMemory, intMemory Dim colBIOS, objBIOS Dim colNetworkAdapterConfiguration, objNetworkAdapterConfiguration Dim colComputerSystem, objComputerSystem Dim colPhysicalMemory, objPhysicalMemory Dim adoConnection, adoRecordset dim mydatestring dim colOperatingSystems,objOperatingSystem,osver dim oReg, lastuser, snode, spath, svaluename, svalue dim colcpu, objItem, cpuspec dim objDisk, colDisks , cspace strComputer = "." strMemory = "" strMake = "" strModel = "" strSerialNumber = "" strMacAddresses = "" myDateString = Date() Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colDisks = objWMIService.ExecQuery _ ("Select * from Win32_LogicalDisk") For Each objDisk in colDisks If objDisk.DeviceID = "C:" Then 'Wscript.Echo "DeviceID: " & objDisk.DeviceID cspace = int(objDisk.Size/1073741824) & " GB" end if Next Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colcpu = objWMIService.ExecQuery("Select * from Win32_Processor") For Each objItem in colcpu cpuspec = objItem.Name Next ' use "." for local computer sNode = "." Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE On Error Resume Next Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ & sNode & "/root/default:StdRegProv") If Err.Number <> 0 Then On Error Goto 0 WScript.Echo "Could not connect to computer " & sNode Else On Error Goto 0 sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" sValueName = "LastLoggedonUser" If oReg.GetStringValue(HKLM, sPath, sValueName, sValue) = 0 Then lastuser = sValue Else lastuser = "unknown" & sNode End If End If Set objRootDSE = GetObject("LDAP://RootDSE") Set objNetwork = WScript.CreateObject("WScript.Network") Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2") Set colComputerSystem = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems osver = objOperatingSystem.Caption & " sp " & objOperatingSystem.ServicePackMajorVersion'& " " & objOperatingSystem.Version Next If Not colComputerSystem Is Nothing Then For Each objComputerSystem In colComputerSystem strMake = objComputerSystem.Manufacturer strModel = objComputerSystem.Model Next End If Set colBIOS = objWMIService.ExecQuery("Select * From Win32_BIOS") If Not colBIOS Is Nothing Then For Each objBIOS in colBIOS strSerialNumber = objBIOS.SerialNumber Next End If Set colNetworkAdapterConfiguration = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") strMacAddresses = "" If Not colNetworkAdapterConfiguration Is Nothing Then For Each objNetworkAdapterConfiguration in colNetworkAdapterConfiguration If strMacAddresses <> "" Then strMacAddresses = strMacAddresses & ", " End If strMacAddresses = strMacAddresses & objNetworkAdapterConfiguration.MACAddress Next End If Set colPhysicalMemory = objWMIService.ExecQuery("Select * From Win32_PhysicalMemory") If Not colPhysicalMemory Is Nothing Then intMemory = 0 For Each objPhysicalMemory In colPhysicalMemory intMemory = intMemory + Int(objPhysicalMemory.Capacity) Next strMemory = (intMemory / 1024 / 1024) & " MB" End If Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Open "Active Directory Provider" If Err.Number <> 0 Then MsgBox "Connect Error: " & Err.Description WScript.Quit End If Set adoRecordset = adoConnection.Execute(";(&(objectCategory=Computer)(name=" & objNetwork.Computername & "));adspath;subtree") If Err.Number <> 0 Then MsgBox "Query Error: " & Err.Description WScript.Quit End If If Not adoRecordset.EOF Then Set objComputer = GetObject(adoRecordset.Fields(0).Value) objComputer.Put "description", "Make, " & strmake & " ,Model, " &strModel & ",cpu," & cpuspec & ",Ram, " & strMemory & ",hdd size," & cspace & " ,Serial No, " & strSerialNumber & " ,MAC Addresses, " & strMACAddresses & "," & osver & ", Last booted, " & mydatestring & ", lastuser, " &lastuser objComputer.SetInfo End If If Err.Number <> 0 Then MsgBox "Write Error: " & Err.Description WScript.Quit End If adds system details ram, serial no, hdd size, last time booted, last user mac address and a few others 1
6Foot2 Posted March 9, 2012 Author Posted March 9, 2012 Thanks. I will try that next week. Is there a limit to the number of characters allowed in the description field? [i am imagining 255 chars] If there is a limit what happens if the limit is exceeded? Hopefully it will just be ignored [and not break Active Directory!]
sted Posted March 9, 2012 Posted March 9, 2012 honestly no idea but i dont seem to of killed anything yet lol
6Foot2 Posted March 12, 2012 Author Posted March 12, 2012 sted: I have added your modified script and it is working without any errors/problems. Thanks.
Arthur Posted March 12, 2012 Posted March 12, 2012 Is there a limit to the number of characters allowed in the description field? [i am imagining 255 chars] It's 1024 characters. This applies to Windows 2000 Server all the way up to Windows Server 8. 1
edutech4schools Posted March 12, 2012 Posted March 12, 2012 Link: Automatically fill the computer description field in Active Directory - 4sysops In the post above they talk about Guys, please beware: if you do it after every logon, you can quickly exhaust the USN for the whole AD domain! And then the domain is dead. At least check if this new objComputer.Description is different from old description (already in AD). is this an issue in steds code above?
sted Posted March 12, 2012 Posted March 12, 2012 In the post above they talk about is this an issue in steds code above? yes mine just dumps it no checking. Wouldnt of though it mattered though as its just replacing the contents of one table with fresh one?
sted Posted March 12, 2012 Posted March 12, 2012 just had a quick google and as usn is a 64 bit integer per item that means i can change an item 18.5 quadrillion times a pc wont get booted that often (i run it as a startup script) i wouldnt of thought. Looks like the usn is per object anyway so worst case i can see is pc01 needs a new account creating
sted Posted March 12, 2012 Posted March 12, 2012 just to be on the safe side new version check existing data and only overwrites if theres a change (tempted to remove last user and last logon then or its going to change everytime anyway) Option Explicit On Error Resume Next Dim objRootDSE, objNetwork, objWMIService, objComputer, datastring Dim strComputer, strMake, strModel, strSerialNumber, strMacAddresses, strMemory, intMemory Dim colBIOS, objBIOS Dim colNetworkAdapterConfiguration, objNetworkAdapterConfiguration Dim colComputerSystem, objComputerSystem Dim colPhysicalMemory, objPhysicalMemory Dim adoConnection, adoRecordset dim mydatestring dim colOperatingSystems,objOperatingSystem,osver dim oReg, lastuser, snode, spath, svaluename, svalue dim colcpu, objItem, cpuspec dim objDisk, colDisks , cspace strComputer = "." strMemory = "" strMake = "" strModel = "" strSerialNumber = "" strMacAddresses = "" myDateString = Date() Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colDisks = objWMIService.ExecQuery _ ("Select * from Win32_LogicalDisk") For Each objDisk in colDisks If objDisk.DeviceID = "C:" Then 'Wscript.Echo "DeviceID: " & objDisk.DeviceID cspace = int(objDisk.Size/1073741824) & " GB" end if Next Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colcpu = objWMIService.ExecQuery("Select * from Win32_Processor") For Each objItem in colcpu cpuspec = objItem.Name Next ' use "." for local computer sNode = "." Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE On Error Resume Next Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ & sNode & "/root/default:StdRegProv") If Err.Number <> 0 Then On Error Goto 0 WScript.Echo "Could not connect to computer " & sNode Else On Error Goto 0 sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" sValueName = "LastLoggedonUser" If oReg.GetStringValue(HKLM, sPath, sValueName, sValue) = 0 Then lastuser = sValue Else lastuser = "unknown" & sNode End If End If Set objRootDSE = GetObject("LDAP://RootDSE") Set objNetwork = WScript.CreateObject("WScript.Network") Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2") Set colComputerSystem = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems osver = objOperatingSystem.Caption & " sp " & objOperatingSystem.ServicePackMajorVersion'& " " & objOperatingSystem.Version Next If Not colComputerSystem Is Nothing Then For Each objComputerSystem In colComputerSystem strMake = objComputerSystem.Manufacturer strModel = objComputerSystem.Model Next End If Set colBIOS = objWMIService.ExecQuery("Select * From Win32_BIOS") If Not colBIOS Is Nothing Then For Each objBIOS in colBIOS strSerialNumber = objBIOS.SerialNumber Next End If Set colNetworkAdapterConfiguration = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") strMacAddresses = "" If Not colNetworkAdapterConfiguration Is Nothing Then For Each objNetworkAdapterConfiguration in colNetworkAdapterConfiguration If strMacAddresses <> "" Then strMacAddresses = strMacAddresses & ", " End If strMacAddresses = strMacAddresses & objNetworkAdapterConfiguration.MACAddress Next End If Set colPhysicalMemory = objWMIService.ExecQuery("Select * From Win32_PhysicalMemory") If Not colPhysicalMemory Is Nothing Then intMemory = 0 For Each objPhysicalMemory In colPhysicalMemory intMemory = intMemory + Int(objPhysicalMemory.Capacity) Next strMemory = (intMemory / 1024 / 1024) & " MB" End If Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Open "Active Directory Provider" If Err.Number <> 0 Then MsgBox "Connect Error: " & Err.Description WScript.Quit End If Set adoRecordset = adoConnection.Execute(";(&(objectCategory=Computer)(name=" & objNetwork.Computername & "));adspath;subtree") If Err.Number <> 0 Then MsgBox "Query Error: " & Err.Description WScript.Quit End If If Not adoRecordset.EOF Then Set objComputer = GetObject(adoRecordset.Fields(0).Value) datastring = "Make, " & strmake & " ,Model, " &strModel & ",cpu," & cpuspec & ",Ram, " & strMemory & ",hdd size," & cspace & " ,Serial No, " & strSerialNumber & " ,MAC Addresses, " & strMACAddresses & "," & osver & ", Last booted, " & mydatestring & ", lastuser, " &lastuser if not objComputer.Description = datastring then 'msgbox "diff" objComputer.Put "description", datastring objComputer.SetInfo else 'msgbox "matches" end if End If If Err.Number <> 0 Then MsgBox "Write Error: " & Err.Description WScript.Quit End If
internetuser Posted March 22, 2012 Posted March 22, 2012 looks good, will give it a try when I get a chance.
JosephMoody Posted May 8, 2013 Posted May 8, 2013 I actually asked Microsoft's Directory Services team about this question because we store everything in separate attributes for AD (and I am talking ManagedBy, Comments, Notes, blank). Here is Microsoft's response: "The current USN is a 64-bit counter maintained by each Active Directory domain controller as the highestCommittedUsn attribute on rootDSE. Being an unsigned 64-bit integer, that means 264-1, which is 18,446,744,073,709,551,615 (i.e. 18 quintillion). Under normal use that is never going to run out. Even more, when AD reaches that top number, it would restart at 1 all over again!" You can read about the ManagedBy and storing the last logged on user here: Find Out What Computer a User Logged Into - DeployHappiness. You can read Microsoft's full reply here: Friday Mail Sack: Drop the dope, hippy! edition - Ask the Directory Services Team - Site Home - TechNet Blogs
edutech4schools Posted May 17, 2013 Posted May 17, 2013 (edited) Finally got round to trying sted's code out above and it does everything except list the last logged user. When I list a computer it has all the details like serial number, memory, OS version etc but not user info. Can someone else confirm my findings as the forum title says otherwise. I am not able to change the code but can see some lastuser references so it should be working. UPDATE: In the AD computer description field at the far right of all the computer info is the word 'Last' and then nothing. Looking at the code it looks like it should say 'Last Booted' followed but last user logged on. Edited May 17, 2013 by edutech4schools
edutech4schools Posted May 17, 2013 Posted May 17, 2013 Fixed the issue which was too many items. I removed the cpu item and the missing fields display
sted Posted May 17, 2013 Posted May 17, 2013 whoa thats an old version of the code there a much newer one on here that dumps to a csv file as well as being much tidier better commented code but as im lazy Option Explicit 'On Error Resume Next dim outputstring, computermodel, cpu, ram, hddcapacity, hddfree, serialno, macaddress, operatingsystem, csvoutput dim stcomputer, colitems, objItem, colcpu, colPhysicalMemory, objPhysicalMemory, intMemory, colDisks, objhdd dim colComputerSystem, colOperatingSystems, objOperatingSystem, colBIOS, objBIOS, colnicconfig, objnicconfig dim objwmiservice, hddtemp, weidata, colWSA, operatingsystemno, Lastuser, oreg, spath, svalue, strvalue, svaluename dim adoutputstring, adoRecordset, adoConnection, objRootDSE, objNetwork, objComputer, existing dim pcname, wshShell, strDirectory, strFile, objFSO, objFolder, objFile, objTextFile, myDateString dim colnet,objnet, linkspeed, objWMIService2 stcomputer = "." myDateString = Date() Set objRootDSE = GetObject("LDAP://RootDSE") Set objNetwork = WScript.CreateObject("WScript.Network") Set objWMIService = GetObject("winmgmts:\\" & stcomputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colcpu = objWMIService.ExecQuery("Select * from Win32_Processor") Set colPhysicalMemory = objWMIService.ExecQuery("Select * From Win32_PhysicalMemory") set coldisks = objWMIService.ExecQuery("Select * From Win32_LogicalDisk") Set colComputerSystem = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") Set colBIOS = objWMIService.ExecQuery("Select * From Win32_BIOS") Set colnicconfig = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") Set colWSA = objWMIservice.ExecQuery("Select * From Win32_WinSAT") Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Open "Active Directory Provider" Set adoRecordset = adoConnection.Execute(";(&(objectCategory=Computer)(name=" & objNetwork.Computername & "));adspath;subtree") Set wshShell = WScript.CreateObject( "WScript.Shell" ) Set objWMIService2 = GetObject("winmgmts:\\" & stComputer & "\root\WMI") Set colnet = objWMIService2.ExecQuery("SELECT * FROM MSNdis_LinkSpeed",,48) 'write file location pcname = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) strDirectory = "\\server\logs$\pc\" strFile = pcname & ".csv" 'make-model For Each objItem In colItems computermodel= objItem.Manufacturer & " " & objItem.Model 'wscript.echo computermodel Next ' Create the File System Object Set objFSO = CreateObject("Scripting.FileSystemObject") 'cpu info For Each objItem in colcpu cpu = objItem.Name 'wscript.echo cpu Next 'ram If Not colPhysicalMemory Is Nothing Then intMemory = 0 For Each objPhysicalMemory In colPhysicalMemory intMemory = intMemory + Int(objPhysicalMemory.Capacity) Next ram = (intMemory / 1024 / 1024 ) & " MB" 'wscript.echo ram End If 'hdd capacity for each objhdd in coldisks If objhdd.DeviceID = "C:" Then hddcapacity = int(objhdd.Size/1073741824) & " GB" hddfree = int(objhdd.freespace/1073741824) & " GB" 'wscript.echo hddfree end if next 'windows version For Each objOperatingSystem in colOperatingSystems operatingsystem = objOperatingSystem.Caption & " sp " & objOperatingSystem.ServicePackMajorVersion operatingsystemno = objOperatingSystem.Version 'wscript.echo operatingsystem Next 'serial no If Not colBIOS Is Nothing Then For Each objBIOS in colBIOS serialno = objBIOS.SerialNumber 'wscript.echo serialno Next End If 'mac address(s) If Not colnicconfig Is Nothing Then For Each objnicconfig in colnicconfig If macaddress <> "" Then macaddress = macaddress & " - " End If macaddress = macaddress & objnicconfig.MACAddress 'wscript.echo macaddress Next End If 'windows experience operatingsystemno = Left( operatingsystemno, 3 ) if operatingsystemno >5.5 then 'vista+ For Each objItem in colWSA 'weidata = "Overall -" & "na" & " - CPU - " & "na" & " - Memory - " & "na" & " - Graphics - " & "na" & " - Gaming graphics - " & "na" & " - hdd - " & "na" weidata = "Overall -" & objItem.WinSPRLevel & " - CPU - " & objItem.CPUScore & " - Memory - " & objItem.MemoryScore & " - Graphics - " & objItem.GraphicsScore & " - Gaming graphics - " & objItem.D3DScore & " - hdd - " & objItem.DiskScore next else 'xp- weidata = "Overall -" & "na" & " - CPU - " & "na" & " - Memory - " & "na" & " - Graphics - " & "na" & " - Gaming graphics - " & "na" & " - hdd - " & "na" end if 'last user if operatingsystemno >5.5 then 'vista+ Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & stcomputer & "/root/default:StdRegProv") If Err.Number <> 0 Then On Error Goto 0 Else On Error Goto 0 sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" sValueName = "LastLoggedonUser" If oReg.GetStringValue(HKLM, sPath, sValueName, sValue) = 0 Then lastuser = sValue Else lastuser = "unknown" & stcomputer End If End If else 'xp- Const HKEY_LOCAL_MACHINE = &H80000002 Set oreg=GetObject("winmgmts:\\" & stComputer & "\root\default:StdRegProv") spath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" svalue = "DefaultUserName" oreg.GetStringValue HKEY_LOCAL_MACHINE, spath, svalue, strValue lastuser=strvalue svalue = "DefaultDomainName" oreg.GetStringValue HKEY_LOCAL_MACHINE, spath, svalue, strValue lastuser = strvalue & "\" & lastuser end if 'Scans data for Net Speed For Each objnet in colnet 'Removes "slow/unused links" if objnet.NdisLinkSpeed/10 > 1000 then linkspeed= objnet.NdisLinkSpeed/10000 & " Mbps" & "-" & linkspeed '& "-" & objnet.NdisLinkSpeed/10000 & " Mbps" end if next 'concatanate data for output outputstring = computermodel & "," & cpu &"," & ram &"," & hddcapacity& "," & serialno & "," & macaddress & "," csvoutput = pcname & "," & computermodel & "," & cpu &"," & ram &"," & hddcapacity& "," & hddfree & "," & serialno & "," & operatingsystem & "," & macaddress & "," & weidata & "," & Lastuser & "," & linkspeed &"," & myDateString &"," ' wscript.echo outputstring ' Check that the strDirectory folder exists If objFSO.FolderExists(strDirectory) Then Set objFolder = objFSO.GetFolder(strDirectory) Else Set objFolder = objFSO.CreateFolder(strDirectory) 'WScript.Echo "Just created " & strDirectory End If If objFSO.FileExists(strDirectory & strFile) Then Set objFolder = objFSO.GetFolder(strDirectory) Else Set objFile = objFSO.CreateTextFile(strDirectory & strFile) 'Wscript.Echo "Just created " & strDirectory & strFile End If set objFile = nothing set objFolder = nothing ' OpenTextFile Method needs a Const value ' ForAppending = 8 ForReading = 1, ForWriting = 2 Const ForAppending = 2 Set objTextFile = objFSO.OpenTextFile _ (strDirectory & strFile, ForAppending, True) ' Writes result every time you run this VBScript objTextFile.WriteLine(csvoutput) objTextFile.Close If Err.Number <> 0 Then MsgBox "Query Error: " & Err.Description WScript.Quit End If If Not adoRecordset.EOF Then Set objComputer = GetObject(adoRecordset.Fields(0).Value) existing = objcomputer.Description if left (existing,1) = "#" and not right (existing,1) = "#" then outputstring = existing & " : " & outputstring & "#" if left (existing,1) = "#" and right (existing,1) = "#" then 'msgbox "data" wscript.quit end if if not objComputer.Description = outputstring then 'msgbox "diff" objComputer.Put "description", outputstring objComputer.SetInfo else 'msgbox "matches" end if End If If Err.Number <> 0 Then MsgBox "Write Error: " & Err.Description WScript.Quit End If
edutech4schools Posted May 20, 2013 Posted May 20, 2013 Thanks @sted Do I need to alter the following to my system? strDirectory = "\\server\logs$\pc\" If so, is that the only line that needs to be changed? Thanks
sted Posted May 20, 2013 Posted May 20, 2013 Thanks @sted Do I need to alter the following to my system? If so, is that the only line that needs to be changed? Thanks yup just set that to wherever you want the csv files dumped everything else is the same as the previous versions the pc accounts need access to write to their own description field in ad (unless you run it as an admin once logged in)
edutech4schools Posted May 20, 2013 Posted May 20, 2013 @sted Sorry to be a pain in the ... Any reason why I am getting a script error Line - 162 Char - 4 Error - Bad file name or number The line in question is Set objFolder = objFSO.CreateFolder(strDirectory)
themightymrp Posted May 20, 2013 Posted May 20, 2013 If you have pre-created a folder for where strDirectory is pointing to, make sure that there are enough permissions for the system to write to it
sted Posted May 20, 2013 Posted May 20, 2013 as above at a guess the \\whatever\wherever is a typo, auth users dosent have modify permissions or non existant
edutech4schools Posted May 20, 2013 Posted May 20, 2013 Also does the logs folder need sharing on the server as logs$.
edutech4schools Posted May 20, 2013 Posted May 20, 2013 OK got it working without errors but I am back to the same issue I had using the older script (forum page 1) in that in AD under the computer description only the first 60% of the fields get listed. If I look in the logs/pc file, all the fields are listed. The only way I could fix this previously with the older script (forum page 1) was to delete some of the fields from the script such as processor. Before I go and delete anything from the new script do you have any ideas. Cheers
sted Posted May 20, 2013 Posted May 20, 2013 the newer version adds less to ad (it only adds stuff that dosent change and dosent add headers. look at line 156 and remove the ' then run it locally see what it displays on the screen it should look like its only set now to add computermodel, cpu, ram, hdd size, serial no and mac address to ad as those are the things i decided id want there and dump the rest wei/free hdd etc in the csv file less writes to ad that way the csv records pcname, computermodel, cpu, ram, hddcapacity, hddfree, serialno, operatingsystem, macaddress, weidata, Lastuser, linkspeed, myDateString 1
edutech4schools Posted May 20, 2013 Posted May 20, 2013 @sted Thanks for the info and a very handy script.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now