i got some problem while preparing some useful script based on PS.
I try to make script which will collect data from Active Directory and Exchange (users/mailboxes), then this data will be processed in further part of script (in some function for example)
function toProcess($userObj, $mailboxObj)
{
echo $userObj.enabled #the output is null
}
$users = get-adusers -Filter * -properties *
foreach($user in $users)
{
$guid = $user.objectGuid.toString()
if($user.mail -ne $null)
{
$mailbox = get-mailbox $guid | select-object *
if($mailbox -ne $null)
{
toProcess($user, $mailbox)
}
}
}
When there is assigned only one parameter ($user) to the onProcess(), function executes correctly and display status of account. When i assign two objects, values becomes null. What's wrong?
I use powershell 2.0