With the code like this:
param
(
[Parameter(Mandatory = $true)]
[string]$TenantId,
[Parameter(Mandatory = $true)]
[System.Uri]$HostUrl,
[Parameter(Mandatory = $true)]
[string]$SiteId,
[Parameter(Mandatory = $true)]
[guid]$WebId,
[Parameter(Mandatory = $true)]
[guid]$ListId,
[Parameter(Mandatory = $true)]
[guid]$UniqueId,
[Parameter(Mandatory = $true)]
[string]$OutFile
)
Connect-MgGraph -Scopes "Sites.FullControl.All" -TenantId $TenantId -ForceRefresh
Get-MgSiteListItemDriveItemContent -ListId $ListId -ListItemId $UniqueId -SiteId "$($HostUrl.DnsSafeHost),$SiteId,$WebId" -OutFile $OutFile
Disconnect-MgGraph
I would like the end user to know how to fetch all required named parameters, e.g. upon executing this script I anticipate something like this
cmdlet at command pipeline position 1
Supply values for the following parameters:
TenantId (to get TenantID go to Admin Center - Settings and copy TenantID): xxx
HostUrl (to get HostUrl copy HostUrl from the log files): yyy-yyy
SiteId (SiteId can be obtained directly in SharePoint site): zzz-zzz-zzz
etc.
I know there is a HelpMessage parameter e.g.
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage="Site name")]
yet I want this message to be displayed when the end-user specifies the value.