【问题标题】:ShareFile (by Citrix) automate Upload with PowerSHellShareFile(由 Citrix)使用 PowerSHell 自动上传
【发布时间】:2019-08-28 19:55:46
【问题描述】:

现在是 2019 年 8 月,我正在尝试找到自动将本地文件上传到 Citrix ShareFile 文件夹的方法。我安装了所有更新和Add-PSSnapin,但仍然无法产生任何结果。有没有人成功做到这一点? 有一些链接here 下面我粘贴了 (c) 预期会执行此操作的脚本。我在第一行遇到错误。

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

【问题讨论】:

    标签: sharefile


    【解决方案1】:

    去这里: https://github.com/citrix/ShareFile-PowerShell/releases

    下载并运行与您的操作系统版本(x32 或 x64)匹配的安装程序,64 位最有可能是正确的。

    确保您运行的是等效版本的 PowerShell(x32 或 x64),因为这两个版本都可在 64 位计算机上使用。您可以运行命令[Environment]::Is64BitProcess 来确定您是否在 64 位 Powershell 中运行。

    然后运行命令:Add-PSSnapin Sharefile

    【讨论】:

      猜你喜欢
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-06
      • 1970-01-01
      相关资源
      最近更新 更多