Forum Discussion
Expand-DedupFile - expand files on other Servers?
I would like to expand multiple files on a File Server that's using deduplication from a remote location.
From my attempts at doing so it doesn't seem to work (The request is not supported), however, it's entirely possible I'm doing something wrong.
Could anyone with experience of using this cmdlet advise if it is possible to expand files on a File Server, that's using deduplication, from a remote location? I would like to avoid having to enter a pssession.
# Prompt user for file path
$folder_location = Read-Host -Prompt 'Enter the path to the files to expand...'
# Enumerate files in folder
foreach ($file in $folder_location)
{
Get-ChildItem -Path $folder_location $file.FullName -File -Recurse -ErrorAction SilentlyContinue -Force | Expand-DedupFile
}
6 Replies
It doesn't seem to work on UNC paths and mapped drives, I changed the script a little bit and used invoke-command to start the command locally on the remote server using the $folder_location to which PowerShell changes it's current directory and recursively deduplicates the files. It does work (Checked using the Measure-DedupFileMetadata cmdlet), but still throws errors like parameter incorrect 🙂
# Prompt user for file path $folder_location = Read-Host -Prompt 'Enter the local path to the files to expand, e.g. e:\data' # Prompt for server name $server = Read-Host -Prompt 'Enter server name' # Run remote command on remote server using foldername Invoke-Command -ComputerName $server -ScriptBlock { Push-Location $using:folder_location Get-ChildItem -Recurse | Expand-DedupFile }- Does this work for you like this?
- user4444Copper ContributorHello,
apologies for the delayed response.
This script doesn't work, but I think it might be more to do with the paths to folders.
Perhaps if I explain the bigger picture it might help.
You were kind enough to help me with a script on another thread where I was searching for folders in various network locations. I suppose we could call that part 1 of the process.
After finding the folders I need to expand the files inside them.
I would like my colleague who uses these scripts to be able to run them from one location (not locally). To do that the paths to search will be network shares rather than local folders.
So, while the script to search for the folders in network shares works, it returns the locations as network paths, not local. The script you have provided here requires local paths. I did some testing using local paths but this didn't work, however, it's quite likely due to me making a mistake.