<# .Synopsis TSSv2Collect_Offline.ps1 .EXAMPLES Invoke-TSSv2Collect_Offline Fixes and Improvements: V 1.2 User can choose the output file name. Check requirements before start scritp (powershell version 5.1 minimum) V 1.3 Added Check-ISEEnvironment to display a warning when run in PowerShell ISE. Removed the SDDC collection from SDPList for non-HCI clusters. #> Function Check-ISEEnvironment { <# .SYNOPSIS Checks if the script is running in PowerShell ISE. .DESCRIPTION This function detects if the current session is running inside PowerShell ISE. If so, it displays a warning and exits the function. .EXAMPLE Check-ISEEnvironment #> if ($psISE) { Write-Warning "This task is not supported in PowerShell ISE. Please run it in the standard PowerShell console with admin rights." return $false } return $true } if (-not (Check-ISEEnvironment)) { return } Function EndScript{ break } #Function Invoke-TSSv2Collect_Offline{ 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 Offline Mode | | | | 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" invoke-expression -command "C:\dell\TSSv2\TSS.ps1 -sdp Setup -skipsdplist skipBPA -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" invoke-expression -command "C:\dell\TSSv2\TSS.ps1 -sdp Cluster -skipsdplist skipBPA, skipSDDC -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" invoke-expression -command "C:\dell\TSSv2\TSS.ps1 -sdp HyperV -skipsdplist skipBPA -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 "Unpacking 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 #Unpacking TSSv2 at C:\Dell #Expand-Archive -Path c:\Dell\TSSv2.zip -DestinationPath c:\Dell\TSSv2\ -ErrorAction Ignore Clear-Host $Ver="1.3" #IE Fix Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name "DisableFirstRunCustomize" -Value 2 #Set Execution Policy Set-ExecutionPolicy Unrestricted DisplayMenu $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 #}