Hi all
Wicked head cold today and I can't think straight...anybody point out
the obvious as my mind is incapable of any normal thought.
<sniff><cough><sniff>
'===============Start Here===================================
On Error Resume Next
Dim EnvironmentType
Dim objshell
Dim dwcorrectValue
Dim dwcorrectvalue2
Dim dwvalue
Dim dwvalue2
Dim result
'==================================================
'Check the Date seperator and the short date format
'if good then move on...if not Getdateformat....
'==================================================
Set objShell = WScript.CreateObject("WScript.Shell")
dwcorrectValue = objShell.RegRead("HKEY_USERS\.DEFAULT\Control Panel
\International\sShortDate")
dwcorrectValue2 = objShell.RegRead("HKEY_USERS\.DEFAULT\Control Panel
\International\sDate")
Wscript.Echo dwcorrectValue
Wscript.Echo dwcorrectValue2
If dwcorrectvalue = "yyyy-MM-dd" Then
Set objShell = WScript.CreateObject("WScript.Shell")
dwcorrectValue2 = objShell.RegRead("HKEY_USERS\.DEFAULT\Control Panel
\International\sDate")
Wscript.Echo dwcorrectValue2
If dwcorrectvalue2 = "-" Then
GetdateStatus
Else
Getdateformat
End If
Sub GetdateStatus()
wscript.echo "Date format is correct"
Wscript.Echo dwcorrectValue
Wscript.Echo dwcorrectValue2
wscript.sleep 1500
End
Sub
Sub Getdateformat()
'==================================================
'Force the Date seperator and the short date format
'then force a reboot
'==================================================
'
'==================================================
'
'Change the sShortDate entry
'Change the sDate entry
'
'==================================================
strKeyPath="HKEY_USERS\.DEFAULT\Control Panel\International"
strEntryName="sShortDate"
Const HKEY_USERS = &H80000003
dwValue="yyyy-MM-dd"
dwvalue2="-"
strComputer="."
Set oReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
oReg.SetDWORDValue _
HKEY_USERS,strKeyPath,strEntryName,dwValue
oReg.SetDWORDValue _
HKEY_USERS,strKeyPath,strEntryName,dwValue2
'Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/
cimv2").ExecQuery("select * from Win32_OperatingSystem where
Primary=true")
'for each OpSys in OpSysSet
' OpSys.Reboot()
Next
End Sub