-
Notifications
You must be signed in to change notification settings - Fork 0
/
RunSpfFile.ahk
55 lines (53 loc) · 1.61 KB
/
RunSpfFile.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#Include UP_DEC.ahk
AdminName = %DecAdminName%
AdminPass = %DecPass%
#Include Add_INI.ahk
Main:
{
If 1 = /S
{
computername = %2%
;FilePath = %3%
Goto RunArbFile
}
;else if 1 = /I
;{
; Compname = %2%
; Gosub PreloadStuff
; Goto ImmediateUP
;}
else
{
Msgbox, yeah.... you didn't give any parameters so im exiting
ExitApp
}
}
Return
RunArbFile:
FileCopy, Config.ini, \\%computername%\%FilePath%, 1
if ErrorLevel > 0
{
MsgBox Fatal Error`n Config could not be copied. `n`nNot arbitrary fileing on %computername%
Return
}
;FileSelectFile, arbitraryfile
arbitraryfile = C:\ADMIN\BOR\SavePrinters.exe
;msgbox, %arbitraryfile%
If ErrorLevel > 0
Return
;Msgbox, Running %arbitraryfile%`nOn %computername%
StringGetPos, locat, arbitraryfile, \, R
locat := locat + 2
stringmid, filename, arbitraryfile, locat
FileCopy, %arbitraryfile%, \\%computername%\%FilePath%, 1
FileAppend, %A_Now% Arb File sent and now executing on %ComputerName% `n, %FILogFile%
;msgbox, psexec \\%computername% -u %AdminName% -p %AdminPass% -h "%RemFilePath%%filename%" /D
Runwait psexec \\%computername% -u %AdminName% -p %AdminPass% -h "%RemFilePath%%filename%" /D
;msgbox, \\%computername%\%FilePath%%filename%
FileDelete \\%computername%\%FilePath%%filename%
;msgbox, \\%computername%\%FilePath%Config.ini
FileDelete \\%computername%\%FilePath%Config.ini
FileAppend, %A_Now% Arb File Deleted and finished executing on %ComputerName% `n, %FILogFile%
IfNotExist, \\%computername%\%FilePath%Printerbackup.printerexport
FileAppend, %A_Now% %ComputerName% FAILED THE PRINTER SAVE. REMEDIATION REQUIRED`n, %FILogFile%
ExitApp