Thanks for the help!

I figured out the blank lines - the output from Get-DfsrBacklog has
lines in it with version vector tombstone data, which isn't the same
as the rest of the output, and doesn't include the fullpathname, so
that field is blank.

So, I changed the first line of the script to this:

$DFSRBacklog = Get-DfsrBacklog -SourceComputerName server1
-DestinationComputerName server2 | Select -Expand FullPathName
$DFSRBacklog = $DFSRBacklog | ? {$_}

That killed the blanks.

As for $_ vs. $Line - oh ye gods. That makes sense, and I've made that
change, and now I'm happ(y|ier), and getting the output I want, except
for just 10 line/files (out of over 1200) - I'm getting this error:

-----
gci : Cannot find path 'K:\drops\TC\Dispatch
5.2\MXC\Controller_v5.2.0.207.zip' because it does not exist.
At line:5 char:7
+       gci $Line | Select FullName,Length,LastWriteTime
+       ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound:
(K:\drops\TC\..._v5.2.0.207.zip:String) [Get-ChildItem],
ItemNotFoundException
    + FullyQualifiedErrorId :
PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
-----

But, when I manually run the command "gci <filename>", I get the
output I expect. The path to the file doesn't always include spaces,
and I don't see anything else in the file name that looks interesting
(such as a space at the end of the name), and the files range from
thumbs.db to .exe files, to .zip files.

Anything I can look for that might help solve this?

Kurt



On Fri, Jan 5, 2018 at 3:58 PM, Michael B. Smith <mich...@smithcons.com> wrote:
> What is $_?
>
> You probably meant to use $Line there.
>
> And you probably want to skip entries that are blank.
>
> -----Original Message-----
> From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] 
> On Behalf Of Kurt Buff
> Sent: Friday, January 5, 2018 6:27 PM
> To: powershell@lists.myitforum.com
> Subject: [powershell] Two questions in one? Score!
>
> Hi all,
>
> Very simple, and almost certainly obvious to you guys what I'm doing
> wrong, but first a question about Get-DFSRBacklog: Why am I seeing
> blank lines in the output for this cmdlet? Anyone have a clue on that?
> The output is always the same for this cmdlet - that is, if I run the
> script several times in a short period of time, the blank lines show
> up in the same place in the output.
>
> Regardless, I do get data stuffed into $DFSRBacklog.
>
> Here's my script:
>
> $DFSRBacklog = Get-DfsrBacklog -SourceComputerName server1
> -DestinationComputerName server2 | Select -expand FullPathName
> $DFSRBacklogListing = ForEach ( $Line in $DFSRBacklog )
>    {
>       gci $_ | Select FullName,Size,LastWriteTime
>     }
>
> When I run this script, it hangs, and I don't get any data in
> $DFSRBacklogListing - but if I break out of it, the data I expect in
> $DFSRBacklog is present.
>
> Kurt
>
>
>
>



Reply via email to