![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Login Script logging I have a logon script that writes values to a CSV file. I want to create some method to minimize the number of missed entries because two people are trying to write to the same file at the same time... I was using Set objTextFileLog = objFSO.OpenTextFile(strSharedFolder & "Logon- WMI.txt", 8, True) objTextFileLog.WriteLine _ Chr(34) & strCurDate & Chr(34) & Chr(9) _ & Chr(34) & strCurTime & Chr(34) & Chr(9) _ & Chr(34) & strUser & Chr(34) & Chr(9) _ & Chr(34) & strComputer & Chr(34) & Chr(9) _ & Chr(34) & OSName & Chr(34) & Chr(9) _ & Chr(34) & OSVersion & Chr(34) & Chr(9) _ & Chr(34) & OSServicePack & Chr(34) & Chr(9) _ & Chr(34) & SystemManufacturer & Chr(34) & Chr(9) _ & Chr(34) & SystemModel & Chr(34) & Chr(9) _ & Chr(34) & SystemType & Chr(34) & Chr(9) _ & Chr(34) & strDellAsset & Chr(34) & Chr(9) _ & Chr(34) & TimeZone & Chr(34) & Chr(9) _ & Chr(34) & TotalPhysicalMemory & Chr(34) & Chr(9) _ & Chr(34) & BiosVersion & Chr(34) & Chr(9) _ & Chr(34) & strValidMACAddress & Chr(34) & Chr(9) _ & Chr(34) & strIPAddress & Chr(34) & Chr(9) _ & Chr(34) & strAVVersion & Chr(34) & Chr(9) _ & Chr(34) & strAVDatVersion & Chr(34) & Chr(9) _ & Chr(34) & strcapacity & Chr(34) & Chr(9) _ & Chr(34) & strfree & Chr(34) & Chr(9) _ & Chr(34) & strDC & Chr(34) & Chr(9) _ & Chr(34) & "V: " & strWordVer & Chr(34) & Chr(9) _ & Chr(34) & strDNSDomain & Chr(34) objTextFileLog.Close Which is working fine, but want to ensure no one is getting left out... I only have 250 users, so the odds that two folks would access the same file are small, (unlike a large 1000+ organization) but just looking for a "better" solution. I had though of using a DO WHILE loop and checking err.number <>0 but don't know of that should be on the WriteLine command or the OpenTextFile command. Or maybe do something different. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Login Script logging A DO WHILE on opening the file exclusively would work best, with provisions to time out in case the other process hangs some how and leaves the file open. "Carl Hilton" <carlvh@newsgroup> wrote in message news:9951bfa1-9342-4d1f-bd2b-4047e92b9d27@newsgroup Quote: >I have a logon script that writes values to a CSV file. I want to > create some method to minimize the number of missed entries because > two people are trying to write to the same file at the same time... I > was using > > Set objTextFileLog = objFSO.OpenTextFile(strSharedFolder & "Logon- > WMI.txt", 8, True) > > objTextFileLog.WriteLine _ > Chr(34) & strCurDate & Chr(34) & Chr(9) _ > & Chr(34) & strCurTime & Chr(34) & Chr(9) _ > & Chr(34) & strUser & Chr(34) & Chr(9) _ > & Chr(34) & strComputer & Chr(34) & Chr(9) _ > & Chr(34) & OSName & Chr(34) & Chr(9) _ > & Chr(34) & OSVersion & Chr(34) & Chr(9) _ > & Chr(34) & OSServicePack & Chr(34) & Chr(9) _ > & Chr(34) & SystemManufacturer & Chr(34) & Chr(9) _ > & Chr(34) & SystemModel & Chr(34) & Chr(9) _ > & Chr(34) & SystemType & Chr(34) & Chr(9) _ > & Chr(34) & strDellAsset & Chr(34) & Chr(9) _ > & Chr(34) & TimeZone & Chr(34) & Chr(9) _ > & Chr(34) & TotalPhysicalMemory & Chr(34) & Chr(9) _ > & Chr(34) & BiosVersion & Chr(34) & Chr(9) _ > & Chr(34) & strValidMACAddress & Chr(34) & Chr(9) _ > & Chr(34) & strIPAddress & Chr(34) & Chr(9) _ > & Chr(34) & strAVVersion & Chr(34) & Chr(9) _ > & Chr(34) & strAVDatVersion & Chr(34) & Chr(9) _ > & Chr(34) & strcapacity & Chr(34) & Chr(9) _ > & Chr(34) & strfree & Chr(34) & Chr(9) _ > & Chr(34) & strDC & Chr(34) & Chr(9) _ > & Chr(34) & "V: " & strWordVer & Chr(34) & Chr(9) _ > & Chr(34) & strDNSDomain & Chr(34) > > objTextFileLog.Close > > Which is working fine, but want to ensure no one is getting left > out... I only have 250 users, so the odds that two folks would access > the same file are small, (unlike a large 1000+ organization) but just > looking for a "better" solution. > > I had though of using a DO WHILE loop and checking err.number <>0 but > don't know of that should be on the WriteLine command or the > OpenTextFile command. Or maybe do something different. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Login Script logging "Carl Hilton" <carlvh@newsgroup> wrote in message news:9951bfa1-9342-4d1f-bd2b-4047e92b9d27@newsgroup Quote: >I have a logon script that writes values to a CSV file. I want to > create some method to minimize the number of missed entries because > two people are trying to write to the same file at the same time... I > was using > > Set objTextFileLog = objFSO.OpenTextFile(strSharedFolder & "Logon- > WMI.txt", 8, True) > > objTextFileLog.WriteLine _ > Chr(34) & strCurDate & Chr(34) & Chr(9) _ > & Chr(34) & strCurTime & Chr(34) & Chr(9) _ > & Chr(34) & strUser & Chr(34) & Chr(9) _ > & Chr(34) & strComputer & Chr(34) & Chr(9) _ > & Chr(34) & OSName & Chr(34) & Chr(9) _ > & Chr(34) & OSVersion & Chr(34) & Chr(9) _ > & Chr(34) & OSServicePack & Chr(34) & Chr(9) _ > & Chr(34) & SystemManufacturer & Chr(34) & Chr(9) _ > & Chr(34) & SystemModel & Chr(34) & Chr(9) _ > & Chr(34) & SystemType & Chr(34) & Chr(9) _ > & Chr(34) & strDellAsset & Chr(34) & Chr(9) _ > & Chr(34) & TimeZone & Chr(34) & Chr(9) _ > & Chr(34) & TotalPhysicalMemory & Chr(34) & Chr(9) _ > & Chr(34) & BiosVersion & Chr(34) & Chr(9) _ > & Chr(34) & strValidMACAddress & Chr(34) & Chr(9) _ > & Chr(34) & strIPAddress & Chr(34) & Chr(9) _ > & Chr(34) & strAVVersion & Chr(34) & Chr(9) _ > & Chr(34) & strAVDatVersion & Chr(34) & Chr(9) _ > & Chr(34) & strcapacity & Chr(34) & Chr(9) _ > & Chr(34) & strfree & Chr(34) & Chr(9) _ > & Chr(34) & strDC & Chr(34) & Chr(9) _ > & Chr(34) & "V: " & strWordVer & Chr(34) & Chr(9) _ > & Chr(34) & strDNSDomain & Chr(34) > > objTextFileLog.Close > > Which is working fine, but want to ensure no one is getting left > out... I only have 250 users, so the odds that two folks would access > the same file are small, (unlike a large 1000+ organization) but just > looking for a "better" solution. > > I had though of using a DO WHILE loop and checking err.number <>0 but > don't know of that should be on the WriteLine command or the > OpenTextFile command. Or maybe do something different. where I trap the possible error and make three attempts to write: http://www.rlmueller.net/Logon5.htm -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Logging Success or Failure of a script | VB Script | |||
| Netware login takes multiple tries before logging in. | Network & Sharing | |||
| Login script | VB Script | |||
| Login script | Vista security | |||
| Login Script Problems | Vista networking & sharing | |||