Friday, June 6, 2014

sync time between 2 windows servers

1:Make sure
HKLM\SYSTEM\CurrentControlSet\services\W32Time\Parameters\Type  value is NT5DS

2:Then type this at an elevated command prompt:
w32tm /config /manualpeerlist:10.0.0.1,0x8 /syncfromflags:MANUAL /update

3:Then restart the Windows Time service and type this to confirm it worked:
w32tm /query /status

Tuesday, June 3, 2014

Install /Unstall .INF driver visual studio setup project

I created a minifilter driver for log /block file access. and need install the driver use visual studio setup project.
Create custom action for install/uninstall .INF driver.

rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\xxx.inf

rundll32 setupapi,InstallHinfSection DefaultUninstall 132 " +chr(34) + installdir +"Drivers\xxx.inf" + chr(34)


Function InstallDriver()
on error resume next
Dim WshShellInstallTest, oExec ,windowsdir
Set WshShellInstallTest = CreateObject("WScript.Shell")
if (Err.Number <> 0) Then
MsgBox "WScript.Shell" & Err.Number & " " & Err.Description
Err.Clear
end if
Dim installdir
installdir = Session.Property("CustomActionData")
if (Err.Number <> 0) Then
MsgBox "CustomActionData" & Err.Number & " " & Err.Description
Err.Clear
end if
WshShellInstallTest.CurrentDirectory = installdir + "Drivers"

Dim InstallUtilPath
'InstallUtilPath = "rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 " + chr(34) +installdir+ "Drivers\xxx.inf" + chr(34)
InstallUtilPath = "rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\xxx.inf" 
MsgBox InstallUtilPath
WshShellInstallTest.Run InstallUtilPath , 0, true
if (Err.Number <> 0) Then
MsgBox "WshShell" & Err.Number & " " & Err.Description
Err.Clear
end if

set WshShellInstallTest = nothing

End Function



Function UnInstallDriver()
on error resume next
Dim WshShellInstallTest, oExec ,windowsdir
Set WshShellInstallTest = CreateObject("WScript.Shell")
if (Err.Number <> 0) Then
MsgBox "WScript.Shell" & Err.Number & " " & Err.Description
Err.Clear
end if
Dim installdir
installdir = Session.Property("CustomActionData")
if (Err.Number <> 0) Then
MsgBox "CustomActionData" & Err.Number & " " & Err.Description
Err.Clear
end if
WshShellInstallTest.CurrentDirectory = installdir + "Drivers"
Dim InstallUtilPath
InstallUtilPath = "Fltmc unload bfaccess"
WshShellInstallTest.Run InstallUtilPath , 0, true
InstallUtilPath = "rundll32 setupapi,InstallHinfSection DefaultUninstall 132 " +chr(34) + installdir +"Drivers\xxx.inf" + chr(34)
if (Err.Number <> 0) Then
MsgBox "WshShell" & Err.Number & " " & Err.Description
Err.Clear
end if

set WshShellInstallTest = nothing

End Function