# Friday, June 06, 2008

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 a number of seriously annoying (to myself and people around me) habits, one of which is having a hard time finding the motivation to get that last 1% bit of work done. I am trying to kill bludgeon that habit, 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!

Sunday, June 08, 2008 2:28:35 PM (Eastern Daylight Time, UTC-04:00)
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!
Jimmy-Q
Sunday, June 08, 2008 6:57:06 PM (Eastern Daylight Time, UTC-04:00)
Hi Jimmy,

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

- Oisin
Monday, June 09, 2008 6:05:56 PM (Eastern Daylight Time, UTC-04:00)
Hi Jimmy,

The issue is now being tracked at:

http://www.codeplex.com/psmobile/WorkItem/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)

Tuesday, June 10, 2008 6:38:51 AM (Eastern Daylight Time, UTC-04:00)
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
Luis Cabrera
Tuesday, June 10, 2008 10:18:34 AM (Eastern Daylight Time, UTC-04:00)
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.
Comments are closed.