1

It's Aug 2019 and I'm trying to find the way automate Upload of local file to Citrix ShareFile folder. I installed all updates and Add-PSSnapin but still fail to produce any result. Did anybody succeeded doing this ? There are some links here Below I pasted (c) script that expected to do this. and error I'm getting on first line.

Add-PSSnapin ShareFile
################################################################################
# DownloadFiles.ps1
#
# This script will download all files from the My Files and Folders area of 
# ShareFile to the local Documents directory.
#

#Run the following interactively to create a login token that can be used by Get-SfClient in unattended scripts
#$sfClient = New-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\YourSubdomain.sfps") -Account YourSubdomain
$sfClient = Get-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\YourSubdomain.sfps")

#ShareFile directory is relative to the root of the account
#get the current user's home folder to use as the starting point
$ShareFileHomeFolder = "sfdrive:/" + (Send-SfRequest $sfClient -Entity Items).Name

#use the local My Documents folder
$LocalPath = (Join-Path $env:USERPROFILE "Documents")

#Create a PowerShell provider for ShareFile at the location specified
New-PSDrive -Name sfDrive -PSProvider ShareFile -Client $sfClient -Root "/"

#download files from a sub-folder in ShareFile to a local folder
#path must be specified (can't use root) so make sure to map the provider at a level higher than you want to copy from
Copy-SfItem -Path $ShareFileHomeFolder -Destination $LocalPath

#Remove the PSProvider when we are done
Remove-PSDrive sfdrive

PS C:\PSR> Add-PSSnapin ShareFile
Add-PSSnapin : The term 'Add-PSSnapin' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Add-PSSnapin ShareFile
+ ~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Add-PSSnapin:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Mich28
  • 519
  • 3
  • 14

1 Answers1

1

Go here: https://github.com/citrix/ShareFile-PowerShell/releases

Download and run the installer that matches your version of Operating System (x32 or x64), 64-bit is the most likely correct one.

Make sure that you are running the equivalent version of PowerShell (x32 or x64) because both versions are available on a 64-bit machine. You can run the command [Environment]::Is64BitProcess to determine if you are running in a 64-bit Powershell or not.

Then run the command: Add-PSSnapin Sharefile

Appleoddity
  • 647
  • 1
  • 6
  • 21