-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGetStorageState.ps1
More file actions
60 lines (42 loc) · 1.83 KB
/
GetStorageState.ps1
File metadata and controls
60 lines (42 loc) · 1.83 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
47
48
49
50
51
52
53
54
55
56
57
58
59
Param(
[string]$ERCSHostIp,
[string]$CloudAdminDomainUser,
[string]$CloudAdminPassword,
[string]$HLHLogPath,
[string]$HLHAdminUser="Administrator",
[string]$HLHAdminPassword
)
$pwd= ConvertTo-SecureString $CloudAdminPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($CloudAdminDomainUser, $pwd)
Write-Host "Establishing remote session to " $ERCSHostIp
$s = New-PSSession -ComputerName $ERCSHostIp -ConfigurationName PrivilegedEndpoint -Credential $cred
$sharepwd = ConvertTo-SecureString $HLHAdminPassword -AsPlainText -Force
$sharecred = New-Object System.Management.Automation.PSCredential ($HLHAdminUser, $pwd)
Write-Host "Running Test-AzureStack"
Invoke-Command -Session $s { Test-AzureStack -Include AzsStorageSvcsSummary, AzsHostingInfraSummary }
$fromDate = (Get-Date).AddMinutes(-15)
$toDate = (Get-Date)
Write-Host "Running Get-AzureStackLog"
$result = Invoke-Command -Session $s { `
Get-AzureStackLog -OutputPath $using:HLHLogPath"\Temp" `
-OutputSharePath $using:HLHLogPath `
-OutputShareCredential $using:shareCred `
-FilterByRole SeedRing `
-FromDate $using:fromDate -ToDate $using:toDate }
if($s)
{
Remove-PSSession $s
}
$result[0] -match ".*\\(AzurestackLogs-.*)\\.*"
$newdir = "SeedRing" #$matches[1]
$resultdir = $HLHLogPath + "\" + $matches[1]
Write-Host "Deleting previous logs"
del -Recurse .\$newdir
write-Host "Extracting log archive in " $resultdir
Expand-Archive -path ($resultdir + "\SeedRing-*.zip") ($newdir + "\temp")
Write-Host "Copying test-azurestack logs "
copy .\$newdir\temp\*\azureStack_validation* .\SeedRing
Write-Host "Deleting log acrhive "
del -Recurse .\$newdir\temp
Write-Host "Test-AzureStack logs:"
dir .\$newdir\AzureStack_Validation*