forked from Matalus/MiscPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Attachmate_Path_Test_CO.ps1
54 lines (48 loc) · 4.06 KB
/
Attachmate_Path_Test_CO.ps1
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
$d = Get-Date -Format MM.dd.yyyy-HH.mm
Stop-Transcript
Start-Transcript \\vault\tech3\Scripts\Matt\logs\Attachmate_Path_Test_CO$d.txt
Import-Module ActiveDirectory
$SERVERS = Get-ADComputer -SearchBase "OU=CO,OU=Servers,DC=SHAMROCKFOODS,DC=COM" -Filter * | sort name | select name
$Count = 0
FOREACH($COMPUTER in $SERVERS)
{$COMPUTER = $COMPUTER.name
#Write-Host $COMPUTER
$Test = Test-Connection -Count 1 -ComputerName $COMPUTER -ErrorAction SilentlyContinue
IF($Test -ne $null)
{
$TEST1 = $null
$TEST2 = $null
$Count++
Write-Host $Count $COMPUTER
$TEST1 = Test-Path "\\$COMPUTER\C$\Program Files\Attachmate"
IF($TEST1 -eq "True")
{Write-Host Attacmate Directory found at "\\$COMPUTER\C$\Program Files\Attachmate"
Invoke-Item "\\$COMPUTER\C$\Program Files\Attachmate"
Write-Host --------------------------------------------
Write-Host Script Paused... Press Any Key to continue.
Write-Host --------------------------------------------
cmd /c pause | Out-Null
}
ELSE
{
#do nothing
}
$TEST2 = Test-Path "\\$COMPUTER\C$\Program Files (x86)\Attachmate"
IF($TEST2 -eq "True")
{Write-Host Attacmate Directory found at "\\$COMPUTER\C$\Program Files (x86)\Attachmate"
Invoke-Item "\\$COMPUTER\C$\Program Files (x86)\Attachmate"
Write-Host --------------------------------------------
Write-Host Script Paused... Press Any Key to continue.
Write-Host --------------------------------------------
cmd /c pause | Out-Null
}
ELSE
{
#do nothing
}
}
ELSE
{Write-Host Ping Failed...
Write-Host ________________________________________________________}
}
Stop-Transcript