MVP Systems - Support
Home
Search All
Go
Advanced Search
Search
Tags
Glossary
Welcome Guest
(
Login
|
Register
)
Latest Additions
Most Popular
Knowledgebase
Downloads
Documentation
Submit Ticket
Home
»
Knowledgebase
»
JAMS
»
How to Use The JAMS File Transfer PowerShell Cmdlets
How to Use The JAMS File Transfer PowerShell Cmdlets
How to Use The JAMS File Transfer PowerShell Cmdlets
In addition to using the "File Transfer" execution method, file transfers can also be performed using the JAMS PowerShell Snap-In. The Snap-In supports transfers in the following forms: FTP, FTPS, and SFTP. Before a connection can be made, you must first define the credentials for the user account that will be connecting to the file server.
[Getting Credentials from a JAMS User]
$userCredentials = Get-JAMSCredential -UserName JAMSUserName -Server JAMSServerName
Once the credentials have been established a connection can then be made.
[Establishing a Connection]
The following example demonstrates the format for establishing an FTP connection:
Connect-JFTP -Credential $userCredentials -Name YourFileServerName
The other two transfer methods follow the same format except that "Connect-JFTP" would be replaced with "Connect-JFTPS" or "Connect-JSFTP". Besides that difference, the following examples are the same for any of the three transfer methods.
Once a connection is made, you can then retrieve or send files to the server.
[Sending & Retrieving Files]
The format for sending a file is as follows:
Send-JFSItem -Name C:\MyFile.txt -Destination C:\ServerDirectory\MyFile.txt
The format for retrieving a file is very similar:
Receive-JFSItem -Name C:\ServerDirectory\MyFile.txt -Destination C:\MyFile.txt
To view files in a directory the cmdlet "Get-JFSChildItem" can be used:
Get-JFSChildItem -Path C:\Logs\
Another option is to view details about a specific item using "Get-JFSItem":
Get-JFSItem -Path C:\Logs\Audit.log
The "Get-JFSChildItem" cmdlet is similar to the PowerShell "Get-ChildItem" cmdlet, they both return a collection of objects. The "Get-JFSChildItem" returns a collection of JAMSFileServerItems. Each JAMSFileServerItems describes an single file or directory that is on the file server. You can process these items using all the standard PowerShell commands, for example:
$fileList = Get-JFSChildItem *.txt
foreach($file in $fileList)
{
if (($file.IsFile) -and ($file.Modified -gt $checkDate))
{
Receive-JFSItem $file
}
}
[Directory Movement]
The "Get-JFSLocation" cmdlet enables you to determine the current path on the file server. An example of using this cmdlet might be to store the current directory in a PowerShell variable:
$CurrentDirectory = Get-JFSLocation
The "Set-JFSLocation" cmdlet allows you to change the directory on the file server and uses the format:
Set-JFSLocation -Location C:\NewDirectory
[Renaming & Removing Files]
Renaming and Removing files is also very simple. An example of renaming a file would be:
Rename-JFSItem -Name OriginalName.txt -NewName NewName.txt
While the format for removing a file is:
Remove-JFSItem -Path "C:\FTPNewName.txt" -Confirm:$false
In the example above, setting the "-Confirm" switch to false means that there should not be a verification prompt before deleting the file.
[Disconnecting]
Once the actions of the file transfer have completed the "Disconnect-JFS" cmdlet should be issued in order to disconnect from the file server.
Any of these cmdlets could be issued from a PowerShell console or from a Job within JAMS that uses PowerShell as it's execution method. Below is a simple example of how to use these cmdlets to perform a FTP transfer:
Rate this Article:
Tags:
PowerShell
Add Your Comments
Name:
*
Email Address:
Web Address:
Verification Code:
*
Details
Last Modified:
Friday, December 17, 2010
Last Modified By:
phils
Type:
HOWTO
Rated 5 stars based on 1 vote
Article has been viewed 1,830 times.
Options
Send by email...
Email Article
Print Article
Bookmark Article
Social Bookmarks...
Social Bookmarks
Comments RSS
Export As PDF
Powered By InstantKB.NET 2011 © 2012
Execution: 0.160.
9 queries.
Compression Disabled.