Hallo,
i have the following script, everything works until the invoke command, if i replace the $profilepath with the actual path "c:\..." then it works. does somebody know where i go wrong ?
Thanks
--------------------------------------------------------------------------------------------------------------------
#look for profile's on a computer , exclude the special profiles
$Profiles = gwmi win32_userprofile -ComputerName $computer | Where-Object {$_.special -ne "False" }
#join path to point direct to the ost location
$ProfilePath= join-path -path $Profiles.localpath -childpath "\AppData\Local\Microsoft\Outlook"
#get all the *.ost files
Invoke-Command -ComputerName $computer -ScriptBlock { gci $profilepath -filter *.ost }