Monday, June 23, 2008

VbScript - Password Reset CS5 Fortres 6

'on error resume next
dim status
dim filesys
dim ccfilesys
Set ccfilesys = CreateObject("Scripting.FileSystemObject")
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists("c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\") Then
StorageType
Else
CCsub
End If

dim choice
choice = MsgBox("Do you want to delete this Password Reset file? (Recommended)", vbYesNo)
If choice = 6 then
'Delete the script
DeleteSelf
else
wscript.quit
end if


Sub DeleteSelf()
Dim objFSO
'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Delete the currently executing script
objFSO.DeleteFile WScript.ScriptFullName
Set objFSO = Nothing
End Sub

Sub Storagetype

If filesys.FolderExists("c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\settings\") Then

Set WshShell = CreateObject( "WScript.Shell" )
objStorageValue = WshShell.RegRead("HKLM\Software\Fortres Grand\FSRT\StorageType")
If objStorageValue = 2 then
wscript.echo "Please run this program on your Central Control Server."
wscript.quit
Else
wscript.echo "Storage is set for local machine."

End If

If filesys.FileExists("c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\Settings\appmgr.ad") then
file = "true"
filesys.DeleteFile "c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\Settings\appmgr.ad"

End If


If file = "true" then
wscript.echo "Old Password Deleted"
Else
wscript.echo "Password file does not exist." & vbCL & " A new file will be created."
End If


strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer)

If filesys.FileExists("c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\Settings\appmgr.default") Then
file = "true"
Set objFile = objWMIService.Get _
("CIM_DataFile.Name='c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\Settings\appmgr.default'")
intReturn = objFile.Copy("c:\Program Files\Fortres Grand\Fortres Security Runtime 6.0\Settings\appmgr.ad")
End If
If file = "true" then
wscript.echo "Your Password is now 'password'"
Else
wscript.echo "Default file missing." & vbCL & " Please contact Technical Support."
wscript.quit
End If
Else
wscript.echo "Clean Slate 5.0 or Fortres 101 6.0 is not installed on this machine."
wscript.quit
End if
End Sub

Sub CCSUB
dim ccfilesys
set ccfilesys = CreateObject("Scripting.FileSystemObject")
If ccfilesys.FileExists("c:\Program Files\Fortres Grand\Central Control 6.0\Settings\appmgr.ad") Then
ccfile = "true"
ccfilesys.DeleteFile "c:\Program Files\Fortres Grand\Central Control 6.0\Settings\appmgr.ad"
End if

If ccfile = "true" then
wscript.echo "Old Password Deleted"
Else
wscript.echo "Password file does not exist." & vbCL & " A new file will be created."
End If


strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer)

If ccfilesys.FileExists("c:\Program Files\Fortres Grand\Central Control 6.0\Settings\appmgr.default") Then
Set objFile = objWMIService.Get _
("CIM_DataFile.Name='c:\Program Files\Fortres Grand\Central Control 6.0\Settings\appmgr.default'")
intReturn = objFile.Copy("c:\Program Files\Fortres Grand\Central Control 6.0\Settings\appmgr.ad")
ccfile = "true"

End if

If ccfile = "true" then
wscript.echo "Your Password is now 'password'"
Else
wscript.echo "Default file missing." & vbCL & " Please contact Technical Support."
wscript.quit
End If
End Sub

0 comments: