none
PowerShell Удаление подкаталогов и файлов. RRS feed

  • Вопрос

  • Добрый день,
    Надо почистить директории %userprofile%\local settings\temp на террминальном сервере.
    Используя такой скрипт: 
    $username = Get-ChildItem "C:\Documents and Settings" | %{$_.name}
    $Username = $username | ForEach-Object{Get-ChildItem $_.name -Force
    Remove-Item "c:\Documents and Settings\$_\Local Settings\Temp\*" -recurse -force -whatIf}

    Вот кусок лога:
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\32".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\33".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\35".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\37".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\38".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\3a".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\3d".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\4".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\5".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\6".
    What if: Performing operation "Remove Directory" on Target "C:\Documents and Set
    tings\vika\Local Settings\Temp\7".

    Но при этом все файлы остаются и подкаталоги не удаляются.
    Помогите с решением пожайлуста.
    23 декабря 2008 г. 11:31

Ответы

Все ответы