Hi,
I want to add a little bit of code as a param. Wanted to know if the below\attached is possible? If is am i approaching this correctly
Advanced Function param
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Advanced Function param
- Attachments
-
- 2017-02-15 10_05_30-SAPIEN PowerShell Studio 2017.png (50.84 KiB) Viewed 1671 times
Re: Advanced Function param
Please do not post images of code. Post the code using the code posting tool so it can be easily read and copied.
The line highlighted will default to the paths to all MSI files. Add () around the code.
The line highlighted will default to the paths to all MSI files. Add () around the code.
Re: Advanced Function param
Thanks, added it correctly this time. By the way is this the best approach?
- function Get-MSIProdCodrRemo () {
- [CmdletBinding()]
- param (
- [Parameter(Mandatory = $true,
- ValueFromPipeline = $true,
- ValueFromPipelineByPropertyName = $true)]
- [string[]]$computername,
- [parameter(Mandatory = $true)]
- [string]$msiAppPath,
- [parameter(Mandatory = $true)]
- [string[]] $PathToMsiInstaller = gci "\\$computername\C$\Windows\Installer\*.msi"
- )
- BEGIN
- {
- BeginBlock
- }
- PROCESS
- {
- ProcessBlock
- }
- END
- {
- EndBlock
- }
- }