This project has moved. For the latest updates, please go here.

Using from powershell

Jun 11, 2014 at 10:37 AM

I'm trying to use this fro powershell to emain an alert if the path is too long under e:\skydrive

I have tried to adapt you powershell script with no luck:
Get-ChildItem -Path $pathToScan -Recurse -Force | Select-Object -Property FullName, @{Name="FullNameLength";Expression={($_.FullName.Length -ge 235)}} | Sort-Object -Property FullNameLength -Descending | ForEach-Object {
    $filePath = $_.FullName
    $length = $_.FullNameLength
     if($length > 235)
       $string = "$length : $filePath"
    # Write to the Console.
    if ($writeToConsoleAsWell) { Write-Host $string }
    #Write to the file.
and I have tried to use the command line tool with no luck either.
My problem is that I can't fint a way to make it execute the exe-file with with the parameters RootDirectory="e:\skydrive" MinLength=235

I think I have tried about anything to escape the "

Can you help me sort it out?
Jun 11, 2014 at 4:53 PM
I'm not sure, but I'm guessing that the SkyDrive directory is one of those special directories, like My Documents, that requires special permissions and causes the exe app to crash. You should be able to use the PowerShell script though if that's the case. One problem I can see in your script is that your Expression should just be "($_.FullName.Length)", not "($_.FullName.Length -ge 235)".