Windows Mobile PowerShell Provider

by oising 6. June 2008 11:00

In the spirit of "tidying things up," and pushing out nearly-there projects, I turned my attention to http://www.codeplex.com/PSMobile. I have my fingers in way too many pies I think and I'm just not finding enough time to get things finished off - but enough is enough. I am trying to clear my plate, and this is fruit number #2 of that attempt at self-correction. I have some other important out of band work that I need to complete, but I find I cannot concentrate on that until these personal projects that have been niggling me for ages are dealt with. Anyway, lets dispel a couple of questions with a screenshot:

Requirements

  • ActiveSync 4.2 or higher (or Windows Mobile Device Centre 6.0+ on Vista) Download
  • A Windows Mobile device (PocketPC/SmartPhone 2002, 2003, 2003SE, Windows Mobile 5, 6 or 6.1)
  • Windows PowerShell 1.0 or 2.0 (CTP) Download

Features

wm61-device

  • Copy, Move, Delete items between folders on your device (including Storage Card) with standard PowerShell Cmdlets
  • Move/Copy files to/from your device and your desktop with ConvertTo-WMFile and ConvertFrom-WMFile
  • Get device information and manipulate and explore the registry with a rich device object returned from Get-WMDevice
  • Invoke-Item against remote items to or execute or trigger their associated applications
  • Invoke-Item with -Local switch to attempt to execute a remote file in the context of your local desktop (e.g. office docs or images/videos)
  • New "Mode" attributes specific to Windows Mobile file attributes: (I)nRom, Rom(M)odule
  • File/Folder objects' attributes can be modified with .Attributes properties just like FileInfos etc.
  • Tab completion with MoW's PowerTab Download

File Manipulation

A picture's worth a thousand words.

images-screenshot

Cmdlets and Definitions

Here's a table of the syntax for the included Cmdlets.

Cmdlet Definition WhatIf / Confirm
ConvertFrom-WMFile * [-Path] [-Destination] [-Force] [-Verbose] Yes
  [-LiteralPath] [-Destination] [-Force] [-Verbose] Yes
ConvertTo-WMFile * [-Path] [-Destination] [-Force] [-Verbose] Yes
  [-LiteralPath] [-Destination] [-Force] [-Verbose] Yes
Get-WMDeviceInfo [-Verbose]  
Get-WMMemoryInfo [-Verbose]  
Get-WMStoreInfo [-Verbose]  
Start-WMActiveSync [-Verbose]  
Stop-WMActiveSync [-Verbose]  
Start-WMProcess [-LiteralPath] [[-Arguments] ] [-Verbose]  
Get-WMDevice [-Verbose]  

* These Cmdlets that accept a path will bind to pipeline input via PSPath property name.

If you've got any problems, suggestions or ideas, please post into the discussions board on the web site. Have fun!

Tags:

.NET | Compact Framework | Monad | Pocket PC | PowerShell | SmartPhone | WinCE | Windows Mobile

Comments (5) -

Jimmy-Q
Jimmy-Q
6/8/2008 6:28:35 PM #

Great!  But I tried the following to remove the read-only flag and it got an assertion failed exception that wasn't handled by PowerShell:

------
$attr = [Nivot.PowerShell.WindowsMobile.CEFileAttributes] 0x844
$file = get-item mobile:\windows\phoneoff.wav
# No error until next line:
$file.attributes = $attr
------

Note that 0x844 is "System, InRom, Compressed".
Thank you!

Reply

Oisin
Oisin
6/8/2008 10:57:06 PM #

Hi Jimmy,

I'll look into this and put an issue on the "issue tracker" on codeplex for you to track it.

- Oisin

Reply

Oisin
Oisin
6/9/2008 10:05:56 PM #

Hi Jimmy,

The issue is now being tracked at:

www.codeplex.com/.../View.aspx?WorkItemId=10317

There is a real error underneath this message you're seeing: "access is denied." I think you should expect this message because the file is on ROM, not the storage card.

As this error only hides another error, it's not scheduled to be fixed until 0.5 (instead of a critical dot release like 0.4.2)

Reply

Luis Cabrera
Luis Cabrera
6/10/2008 10:38:51 AM #

This looks like a really useful tool!

It would be nice if it allowed you to write/read registry entries on the device.

Thanks!
-Luis

Reply

Oisin
Oisin
6/10/2008 2:18:34 PM #

Hi Luis,

It does allow you, but not through the provider interface (yet). You can use the Get-WMDevice cmdlet to return a device object which provides access into the registry for read/write through properties; one for each hive.

Reply

Add comment



  Country flag
biuquote
  • Comment
  • Preview
Loading


About the author

Oisin Grehan lives in Montreal, Canada and builds all sorts of crap for all sorts of people.

Month List

Page List