Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 588
  • Last Modified:

Can't create Remote App via Powershell that points to an Excel workbook

I am using Windows Server 2008 R2.

I'm trying to use Powershell to create a new Remote App that points to an Excel workbook. The following script fails on the New-Item call:

PS C:> Import-Module RemoteDesktopServices

PS C:> cd RDS:

PS RDS:\RemoteApp> New-Item -Path RDS:\RemoteApp\RemoteAppPrograms -Name "ATM999" -Appli 9\ATM999_Cube.xlsx"

New-Item : An unknown error has occurred. At line:1 char:9 + New-Item <<<< -Path RDS:\RemoteApp\RemoteAppPrograms -Name "ATM999" -ApplicationPath ube.xlsx" + CategoryInfo : NotSpecified: (RDS:\RemoteApp\RemoteAppPrograms\ATM999:Stri + FullyQualifiedErrorId : UnknownError,Microsoft.PowerShell.Commands.NewItemCommand

As a test, I attempted to create a new item that points to an executable rather than an Excel workbook. That works. Is there a parameter or something that I'm missing that would let me create a Remote App against an Excel workbook?
0
ryanmaves
Asked:
ryanmaves
  • 4
  • 3
1 Solution
 
QlemoC++ DeveloperCommented:
Why not providing the path to Excel as Remote App?
0
 
ryanmavesAuthor Commented:
Because we need the user to open a specific workbook when they launch the Remote App RDP file.  It contains database connection information that is specific to the user.
0
 
QlemoC++ DeveloperCommented:
Of course you want to open a specifc workbook. But the correct command to do so is e.g.
"c:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" 9\ATM999_Cube.xlsx

Open in new window

0
New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

 
ryanmavesAuthor Commented:
I understand how to invoke Excel while having it open a specific workbook if I were to do it via the command line but this doesn't answer how to do it within a Powershell's New-Item command.
0
 
QlemoC++ DeveloperCommented:
The error message of New-Item is specific to the item you want to create - here it is a Remote App entry. I'm convinced it isn't related to New-Item itself.
So use the path to Excel as ApplicationPath, and provide the XLSX as additional parameters (how ever you can do that - don't know and cant't test the RDS provider, sorry).
0
 
ryanmavesAuthor Commented:
Figured it out.  Here's what I did:

Import-Module RemoteDesktopServices

cd RDS:

New-Item –Path RDS:\RemoteApp\RemoteAppPrograms –Name Workbook.xlsx –ApplicationPath "C:\Program Files\Microsoft Office\Office14\Excel.exe" –CommandLineSetting 2 -RequiredCommandLine "E:\ProcessingFolder\ClientName_Cube.xlsx"


This creates an entry that points to Excel but specifies the path to the workbook in the RequiredCommandLine parameter.  The "2" setting for CommandLineSetting forces the Remote App to always use the supplied RequiredCommandLine parameter.
0
 
ryanmavesAuthor Commented:
Pointed me in the right direction.  Thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now