Hello,
Am testing using the PowerShell Start-Job commend, I have been successful in what I need but have run into an issue.
$id = '58*'
$jobScript = { Get-ADUser -Properties employeeID, mail -Filter {employeeID -like $args} | Out-String }
try
{
$job = Start-Job -Name "Pro" -InitializationScript {Import-Module ActiveDirectory} -ArgumentList $id -ScriptBlock $jobScript
}
catch [Exception]
{
Write-Debug $_
}
$jobdata = Receive-Job -Name "Pro"
But I get this error;
Invalid type 'System.Object[]'.
Parameter name: employeeID
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ArgumentException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Commands.GetADUser
+ PSComputerName : localhost
Am I able to pass the string $id into the Start-Job?!?
Thanks for any help.
Karl