Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


I need some help with DATE

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,35665
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> I need some help with DATE
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 I need some help with DATE - 6/22/2006 3:13:52 AM   
  BDIntern

 

Posts: 34
Score: 0
Joined: 5/19/2006
Status: offline
I have a script that searches finds the last logontime of a computer then outputs the file to a spread sheet. I want to add the current date into the description of the computer.

But my I'm getting an error in this line:             objuser.put "description", date


Here is the entire script:

'On error resume next
dim outputfile
Dim FileSystem

Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("Test.xls", True)


set objou= getobject ("LDAP://ou=Test XPcomputers,ou=towson, dc=naptg,dc=com")
for each objuser in objou
Set objLastLogon = objUser.Get("lastlogon")
   intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart
   intLastLogonTime = intLastLogonTime / (60 * 10000000)
   intLastLogonTime = intLastLogonTime / 1440
   intLastLogonTime = intLastLogonTime + #1/1/1601#
'outputfile.writeline "Computer Name" & " " & "Date of Last Logon"
if (DateDiff("d",intLastLogonTime,Now) > 60)Then
objuser.put "description", date
objuser.setinfo
outputfile.writeline objuser.sAMAccountName & " "& DateDiff("d",intLastLogonTime,Now)
end if
next
wscript.echo "Done!"

_____________________________

"640k ought to be enough for anybody"
-Bill Gates
 
 
Post #: 1
 
 RE: I need some help with DATE - 6/22/2006 3:32:58 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
What is the error that you get?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to BDIntern)
 
 
Post #: 2
 
 RE: I need some help with DATE - 6/22/2006 4:45:58 AM   
  BDIntern

 

Posts: 34
Score: 0
Joined: 5/19/2006
Status: offline
Sorry I forgot to add that. The error I'm getting is that the date won't enter. But if I put something in quotes
for example:  objuser.put "description", "blah"

blah would be entered in the description and it works. But for some reason date will not work.

Thanks

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: I need some help with DATE - 6/22/2006 4:56:33 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
What about:

bjuser.put "description", CStr(date)

Or:

bjuser.put "description", CStr(Now())

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to BDIntern)
 
 
Post #: 4
 
 RE: I need some help with DATE - 6/22/2006 6:21:17 AM   
  BDIntern

 

Posts: 34
Score: 0
Joined: 5/19/2006
Status: offline



The CStr(date) worked.

Thank you!

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ebgreen)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> I need some help with DATE Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts