whorsfall
asked on
Powershell V2 pipleline include value from a function
Hi,
I am trying to work out how to put the return value of a function into a powershell pipeline.
Here is my basic code that does not work below. Any ideas on how to change this to make it work.
Thanks,
Ward
I am trying to work out how to put the return value of a function into a powershell pipeline.
Here is my basic code that does not work below. Any ideas on how to change this to make it work.
Thanks,
Ward
function fnPackage_Type($package_type)
{
switch ($package_type)
{
0 {"Software Distribution Package"}
3 {"Driver Package"}
4 {"Task Sequence Package"}
5 {"Software Update Package"}
6 {"Device Setting Package"}
7 {"Virtual Package"}
257 {"Image Package"}
258 {"Boot Image Package"}
259 {"Operating System Install Package"}
default {"Unknown"}
}
}
$site_code = "S01"
$computer = "localhost"
$query = "Select * from SMS_PackageBaseclass"
$data = Get-WmiObject -ComputerName $computer -Namespace ("root\SMS\Site_" + $site_code) -query $query
$results = $data | Select-Object Name,PkgSourcePath,PackageType,fnPackage_Type($_.PackageType)
$results
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window