-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTSSv2Collect.ps1
104 lines (96 loc) · 3.45 KB
/
TSSv2Collect.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<#
.Synopsis
TSSv2Collect.ps1
.EXAMPLES
Invoke-TSSv2Collect
#>
Function EndScript{
break
}
#Function Invoke-TSSv2Collect{
function DisplayMenu {
$DateTime=Get-Date -Format yyyyMMdd_HHmmss
Start-Transcript -NoClobber -Path "C:\Dell\TSSv2Collect_$DateTime.log"
Clear-Host
Write-Host @"
+===============================================+
| TSSv2 - Log Collection v$Ver |
| |
| By: Fabiano Inacio |
+===============================================+
| |
| 1: Press '1' for Default collection. |
| 2: Press '2' for Cluster collection. |
| 3: Press '3' for HyperV collection. |
| Q: Press 'Q' for Exit. |
+===============================================+
"@
$MENU = Read-Host "OPTION"
Switch ($MENU)
{
1 {
#OPTION1 - Default Collection
invoke-expression -command "C:\dell\TSSv2\TSSv2.ps1 -sdp Setup -LogFolderPath $dell -AcceptEula"
cd $tss
$Shell = New-Object -ComObject "WScript.Shell"
$Button = $Shell.Popup("Logs available at C:\Dell\SDP_Setup\", 0, "Collection Successfull", 0)
DisplayMenu
}
2 {
#OPTION2 - Cluster Collection
invoke-expression -command "C:\dell\TSSv2\TSSv2.ps1 -sdp Cluster -LogFolderPath $dell -AcceptEula"
$Shell = New-Object -ComObject "WScript.Shell"
$Button = $Shell.Popup("Logs available at C:\Dell\SDP_Cluster\", 0, "Collection Successfull", 0)
Start-Sleep -Seconds 2
DisplayMenu
}
3 {
#OPTION3 - HyperV Collection
invoke-expression -command "C:\dell\TSSv2\TSSv2.ps1 -sdp HyperV -LogFolderPath $dell -AcceptEula"
$Shell = New-Object -ComObject "WScript.Shell"
$Button = $Shell.Popup("Logs available at C:\Dell\SDP_HyperV\", 0, "Collection Successfull", 0)
Start-Sleep -Seconds 2
DisplayMenu
}
Q {
#OPTIONQ - EXIT
Write-Host "Bye"
Stop-Transcript
EndScript
}
default {
#DEFAULT OPTION
Write-Host "Option not available"
Start-Sleep -Seconds 2
DisplayMenu
}
}
}
#}
$dell="c:\Dell\"
$TSS="C:\dell\TSSv2\"
Clear-Host
Write-Host "Downloading TSSv2..."
#Deleting old log collections and transcript logs
Remove-Item "C:\Dell\SDP_*" -recurse -force -ErrorAction Ignore
Remove-Item "C:\Dell\TSSv2Collect*.log" -recurse -force -ErrorAction Ignore
Remove-Item "C:\Dell\Tssv2" -recurse -force -ErrorAction Ignore
Remove-Item "C:\Dell\TSSv2.zip" -recurse -force -ErrorAction Ignore
#Creating c:\Dell folder and downloading TSSv2
mkdir c:\Dell -ErrorAction Ignore
wget http://aka.ms/getTss -OutFile c:\Dell\TSSv2.zip
#Unpacking TSSv2 at C:\Dell
Expand-Archive -Path c:\Dell\TSSv2.zip -DestinationPath c:\Dell\TSSv2\ -ErrorAction Ignore
Clear-Host
$Ver="1.1"
#IE Fix
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name "DisableFirstRunCustomize" -Value 2
#Set Execution Policy
Set-ExecutionPolicy Unrestricted
DisplayMenu
#Invoke-TSSv2Collect
$logfolder=(gci -Path c:\dell\SDP_* | ? { $_.PSIsContainer } | sort CreationTime).name
Write-Host "Logs available at c:\Dell\$logfolder"
#Removing extracted collector and zip file
Remove-Item "C:\Dell\Tssv2" -recurse -force -ErrorAction Ignore
#}