Skip to content

Commit b5940fa

Browse files
committed
add file to user appdata to make sure they get message only once
1 parent a541df5 commit b5940fa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/UpdateModules.ps1

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

7070
if ($ModulePath -like "*Profile*")
7171
{
72-
Write-Host "here"
73-
$template = $template -replace "%PSVersionDeprecationMessage%", "Write-Warning `"PowerShell version 3 and 4 will no longer be supported starting in May 2018. Please update to the latest version of PowerShell 5.1`""
72+
$SpecialFolderPath = [Environment]::GetFolderPath("ApplicationData")
73+
$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`""
74+
$template = $template -replace "%PSVersionDeprecationMessage%",
75+
"if (!(Test-Path '$SpecialFolderPath\Windows Azure Powershell\PSDeprecationWarning.txt')) { `
76+
Write-Warning $WarningMessage `
77+
$WarningMessage | Out-File -FilePath '$SpecialFolderPath\Windows Azure Powershell\PSDeprecationWarning.txt' `
78+
}"
7479
}
7580
else
7681
{
77-
Write-Host "here1"
7882
$template = $template -replace "%PSVersionDeprecationMessage%", ""
7983
}
8084

0 commit comments

Comments
 (0)