Я пытаюсь передать параметры в мой скрипт здесь:
# Get current Year and Month
param ([Int32]$Year, [Int32]$Month, [String]$Environment, [String]$Report, [String]$Username, [String]$Password)
function Get-DaysOfMonth {
Param ([Int32]$Year, [Int32]$Month)
$MonthDays = New-Object System.Collections.Generic.List[System.Object]
1..([datetime]::DaysInMonth($Year, $Month)) |
ForEach-Object {
$Day = ([datetime]::ParseExact("$_/$Month/$Year", "d/M/yyyy", [System.Globalization.CultureInfo]::InvariantCulture)).ToString("dd")
$MonthDays.Add($Day)
}
return $MonthDays
}
Write-Host ("The Year Selected is: {0}" -f $Year)
Write-Host ("The Month Selected is: {0}" -f $Month)
Write-Host ("The Environment Selected is: {0}" -f $Environment)
Write-Host ("The Report Generated is: {0}" -f $Report)
Write-Host ("Export Generating as User: {0}" -f $Username)
Проблема заключается в запуске следующего из командной строки:
myscript.ps1 -Year 2018 -Month 02 -Environment PROD -Report event -Username myname -Password mypass
Это повторный анализ 02
как 2