Leave a comment

Using Powershell to copy data from your apple iPad/iPhone

With the recent release of secRMM 5.7, you can use the secRMM SDK/API to copy data to and from mobile devices.  This includes apple mobile devices.  For an overview of the apple functionality provided by secRMM, please read this blog.

secRMM provides an out-of-the-box “Windows explorer like GUI” program called SafeCopy which allows you to do file copies interactively.

Today, though, we will show IT admins how to do this programmatically using Microsoft Powershell.

Here is the code.  Hopefully to the Powershell enthusiast, it is self explanatory.

#To run this batch, from a DOS command window, type:
#powershell “& ‘C:\BlogPost\CopyFromDevice.ps1′”

#Create the secRMM mobile device object
$l_objSecRMM = New-Object -COM secRMMWPDApiCOM;

#Lets set the device, source file and target file
$l_strMobileDevice = “My iPad
$l_strAppleSource = “com.myCompany.mobileApp1/Documents/TodaysSales.docx“;
$l_strWindowsTarget = “C:\Users\Angela\SalesFor08092014.docx“;

#Lets execute the file copy operation
$l_strReturnCode =
$l_objSecRMM.CopyFileFromDevice($l_strMobileDevice,
$l_strAppleSource,
$l_strWindowsTarget);

if ($l_strReturnCode -eq “1”)
{
Write-Host $l_strAppleSource “copied to” $l_strWindowsTarget;
}
else
{
Write-Host $l_strAppleSource “NOT copied to” $l_strWindowsTarget “:” $l_strReturnCode;
}

For more details, please see https://www.youtube.com/watch?v=EYVn6pfk6lw

Happy scripting!

P.S. Yes, you can do the exact same in VBScript and JScript or in your favorite .Net language.  Native C++ coders, there is a tlb for you to #import as well!

A free two week trial of secRMM is available at Squadra Technologies.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: