- PowerShell for Office 365
- Martin Machado Prashant G Bhoyar
- 244字
- 2021-07-02 18:50:37
Parameters
Parameters are the input values that we pass to a cmdlet. For example, if we have to get the time zone, we can use the following cmdlet:
Get-TimeZone
This cmdlet gets the current time zone or a list of available time zones.
These are the parameters:
- [-Id]: Specifies, as a string array, the ID or IDs of the time zones that this cmdlet gets
- [-ListAvailable]: Indicates that this cmdlet gets all available time zones
- [-Name]: Specifies, as a string array, the name or names of the time zones that this cmdlet gets
We can use this command with or without these parameters:
Get-TimeZone
The following screenshot shows the output for the preceding command:

We can use this command with the Name parameter:
Get-TimeZone -Name "*pac*"
The following screenshot shows the output for the preceding command:

We can use this command with the ListAvailable parameter:
Get-TimeZone -ListAvailable
The following screenshot shows the output for the preceding command:

In PowerShell, variables are always prefixed by the character $ and can include any alphanumeric character or underscore in their names. We can store the output from a cmdlet in a variable and use it later on in other cmdlets or for other purposes in the script, such as writing to the host, using it for comparison, or creating another variable, such as this, for example:
$timeZone = Get-TimeZone
Write-Host "The current time zone is " $timeZone
The following screenshot shows the output for the preceding command:

- 一步一步學Spring Boot 2:微服務項目實戰
- 深入淺出Electron:原理、工程與實踐
- Learn Swift by Building Applications
- Python機器學習經典實例
- 基于Swift語言的iOS App 商業實戰教程
- Python High Performance Programming
- Odoo 10 Implementation Cookbook
- Android Development Tools for Eclipse
- 從零開始學Selenium自動化測試:基于Python:視頻教學版
- Visual C++從入門到精通(第2版)
- LabVIEW入門與實戰開發100例(第4版)
- Apache Solr for Indexing Data
- INSTANT Lift Web Applications How-to
- Mastering High Performance with Kotlin
- ASP.NET 3.5系統開發精髓