Powershell 數值VARIABLE問題

本帖最後由 wongcc2006 於 2017-11-1 01:39 編輯

本身有個SCRIPT去GET MESSAGE TRACE (O365)

而家有DD低能

想問問有無可能USER INPUT想睇幾個個PAGE (X) ,然後自動RUN相對次數 (-PAGE X)

之後export-csv trace(X).csv
  1. write-host "getting trace (pass 1 of 10)"
  2. Get-MessageTrace -Page 1 -PageSize 5000  |select  Received,        SenderAddress,        RecipientAddress,        Subject,        Status,        Index| Export-Csv trace1.csv  -NoTypeInformation  -Encoding UTF8
  3. write-host "getting trace (pass 2 of 10)"
  4. Get-MessageTrace -Page 2 -PageSize 5000  |select  Received,        SenderAddress,        RecipientAddress,        Subject,        Status,        Index| Export-Csv trace2.csv  -NoTypeInformation  -Encoding UTF8
  5. write-host "getting trace (pass 3 of 10)"
  6. Get-MessageTrace -Page 3 -PageSize 5000  |select  Received,        SenderAddress,        RecipientAddress,        Subject,        Status,        Index| Export-Csv trace3.csv  -NoTypeInformation  -Encoding UTF8
  7. write-host "getting trace (pass 4 of 10)"
  8. Get-MessageTrace -Page 4 -PageSize 5000  |select  Received,        SenderAddress,        RecipientAddress,        Subject,        Status,        Index| Export-Csv trace4.csv  -NoTypeInformation  -Encoding UTF8
  9. write-host "getting trace (pass 5 of 10)"
  10. Get-MessageTrace -Page 5 -PageSize 5000  |select  Received,        SenderAddress,        RecipientAddress,        Subject,        Status,        Index| Export-Csv trace5.csv  -NoTypeInformation  -Encoding UTF8
複製代碼

https://ss64.com/ps/
睇 Read-Host 同 For

via HKEPC Reader for Android

TOP