Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Invoke command GCI

$
0
0

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 } 

 

 


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images