-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPsExec-BatchRemoteInstall.ps1
More file actions
48 lines (37 loc) · 1.43 KB
/
PsExec-BatchRemoteInstall.ps1
File metadata and controls
48 lines (37 loc) · 1.43 KB
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
# RCautomate.com
# PSEXEC deployer Script
# Mimicks SCCM or Ansible to deploy software or scripts utilizing PSEXEC
# Uncomment a value to select a list of servers to deploy to
# The intent of having multiple lines with different lists is to deploy in a careful staged manner.
# This allows a moment to gather data, feedback and testing before deploying to a larger userbase.
# Ring 1 (smallest), Ring 2 (smaller), Ring 3 (small), Prod Auto Patch, Prod Manual Patch
#Ring 1 (Dev)
$serverlist = "RCVMAPPDEV1", "RCVMAPPDEV2"
#Ring 2 (Test)
#Ring 3 (Pre-Production)
#Prod Auto (Production)
#Prod Manual (Crown Jewel Production)
foreach ($server in $serverlist){
#Is the server online/active? Ping it, if not, stop.
$Ping = (Test-Connection $server -Count 1 -ErrorAction SilentlyContinue).ResponseTime
If ($null -ne $Ping)
{
#Copy to local machine
xcopy C:\temp\appsource\* \\$server\c$\temp\appdest\*
#Run on local machine
.\PsExec.exe \\$server C:\temp\appdest\install.bat
#look for success, this is dependent on the specific application output - WILL NEED REVIEW
$success = Select-String "Installation completed successfully." '\\$server\c$\Program Files\Logs\install.log'
if($null -eq $success)
{Write-Host "$server has FAILED to install!"}
else {
Write-Host "$server is SUCCESSFULLY INSTALLED."
#cleanup local files
Remove-Item \\$server\c$\temp\appdest -Force -Recurse
}
$Ping = $null
}
else {
Write-Host "$server is OFFLINE!"
}
}