Skip to content

Commit ee60c38

Browse files
committed
update path and error handling
1 parent b5940fa commit ee60c38

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/UpdateModules.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ function Create-ModulePsm1
6969

7070
if ($ModulePath -like "*Profile*")
7171
{
72-
$SpecialFolderPath = [Environment]::GetFolderPath("ApplicationData")
72+
$SpecialFolderPath = Join-Path -Path ([Environment]::GetFolderPath("ApplicationData")) -ChildPath "Windows Azure Powershell"
73+
$DeprecationFile = Join-Path -Path $SpecialFolderPath -ChildPath "PSDeprecationWarning.txt"
7374
$WarningMessage = "`"PowerShell version 3 and 4 will no longer be supported starting in May 2018. Please update to the latest version of PowerShell 5.1`""
7475
$template = $template -replace "%PSVersionDeprecationMessage%",
75-
"if (!(Test-Path '$SpecialFolderPath\Windows Azure Powershell\PSDeprecationWarning.txt')) { `
76+
"if (!(Test-Path '$DeprecationFile')) { `
7677
Write-Warning $WarningMessage `
77-
$WarningMessage | Out-File -FilePath '$SpecialFolderPath\Windows Azure Powershell\PSDeprecationWarning.txt' `
78+
try { `
79+
$WarningMessage | Out-File -FilePath '$DeprecationFile' `
80+
} catch {} `
7881
}"
7982
}
8083
else

0 commit comments

Comments
 (0)