Script windows current date

Desdichado

Limp Gawd
Joined
Apr 22, 2006
Messages
331
I'm in a situation where I have a program that I have to use that has trouble with dates after 2000. I was wondering if there was an easy way to write a .vbs to change the date to a specific date (say, today's date, 1999). I know this should be easy, and I've used vb scripts quite a bit, but I can't figure out how to actually make it work.

this is what I've been trying. It outputs the correct date, but nothing happens to the windows date-time.

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objItem in colItems
objItem.LocalDateTime = "19991215232705.171000-300"
wscript.echo objItem.LocalDateTime
Next
 
I can't quite figure out what it is you're trying to do.

The code you've written doesn't do anything interesting because you get a recordset, then get row objects in each item. Before printing the recordset object value, you change it to a constant. Changing an item in a recordset doesn't affect anything except that row item in the recordset.

If you can provide some more details about what you want to happen, I might be able to help you out. As it stands, though, I can't really figure out what you're after.
 
eh, I decided to scrap that idea and just write my own program to replace the old one. The idea was to make a script which would set the computer's clock to a specific date before the year 2000, and then run the program. And yeah, I know that what I had wasn't the right way to go about it. I was wondering how to change the current time in windows through a vb script (if that is possible)
 
Back
Top