Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Not able to return correct value from invoke-Command

$
0
0

Hello,

I am trying to run a scan on large amount of machine and find a particular file and it last modification time.

Here is the code that i am using.

Invoke-Command -ComputerName vmvpc020127 -ScriptBlock { 


get-childitem "\\vmvpc020127\c$\Users" -recurse | where {$_.extension -eq ".LOC"} | select Fullname,LastWriteTime



}

i am not getting the desired output. the output that i am getting is something like this.

FullName           : \\vmvpc020127\c$\Users\PraphullaA.Chaudhari\vmvpc020664.pcg.ad.msdwis.com.HOD.LOC
LastWriteTime      : 3/13/2014 9:39:06 AM
PSComputerName     : vmvpc020127
RunspaceId         : d6852be5-1f19-49da-8151-06de972c7e4a
PSShowComputerName : True

FullName           : \\vmvpc020127\c$\Users\PraphullaA.Chaudhari\vmvpc021272.pcg.ad.msdwis.com.HOD.LOC
LastWriteTime      : 3/13/2014 11:42:00 AM
PSComputerName     : vmvpc020127
RunspaceId         : d6852be5-1f19-49da-8151-06de972c7e4a
PSShowComputerName : True

Instead i want the output in a table form.

get-childitem "\\vmvpc020127\c$\Users" -recurse | where {$_.extension -eq ".LOC"} | select Fullname,LastWriteTime

?

The issue seems to be with the inclusion of invoke command.

Regards,



Divyansh



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>