Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Dim objShell
- Dim objFSO
- Dim objFile
- Dim strRemoteFile
- Dim strCentralRepository
- Dim strCmd03
- Dim objArgs, strSourceComputer, strDestinationComputer, intArg
- Dim strToSplit, strSplitted, strSplitElement, myArray
- dim error, error1
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objShell = WScript.CreateObject("WScript.Shell")
- Set objFile = objFSO.OpenTextFile("C:\USMTScript\loadstatemachines.txt")
- strCentralRepository = "\\192.168.1.120\USMTScript\USMTCentralRepository"
- Do Until objFile.AtEndOfStream
- redim myArray(2)
- myArray = split(objFile.Readline,",")
- strSourceComputer = UCase(myArray(0))
- strDestinationComputer = UCase(myArray(1))
- wscript.echo "The source PC is " & strSourceComputer & " and " & "the destination PC is " & strDestinationComputer
- call RunLoadstate(strSourceComputer, strDestinationComputer)
- loop
- objFile.close
- Set objFSO = Nothing
- Set objShell = Nothing
- Set objFile = Nothing
- sub RunLoadstate(strSourceComputer, strDestinationComputer )
- If objFSO.FileExists(strCentralRepository & "\" & strSourceComputer & "\USMT\USMT.MIG" ) Then
- msgbox("The File Exists, we will move on with checking the second"
- strRemoteFile = "\\" & strDestinationComputer & "\C$\USMTLocalLoadstate.vbs"
- objFSO.CopyFile "C:\USMTScript\USMTLocalLoadstate.vbs", strRemoteFile, TRUE
- If objFSO.FileExists(strRemoteFile) Then
- msgbox("The File Exists Again! this means there will be no errors")
- objShell.Run "psexec \\" & strDestinationComputer & " -s cmd /c " & chr(34) & "cscript.exe c:\USMTLocalLoadstate.vbs" & " " & strSourceComputer & chr(34)
- Else
- msgbox("file " & strRemoteFile.tostring & " Does not exists! this is technically the 2nd error")
- wscript.sleep 6000
- error1 = MsgBox("Check " & strDestinationComputer & " is online",16,"Error")
- document.write(error1)
- End if
- Else
- msgbox("The original file does not exist, this is the first if statement error")
- wscript.sleep 6000
- error = MsgBox("Unable to find the USMT MIG file for " & strSourceComputer,16,"Error")
- document.write(error)
- End If
- end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement