Solved

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

Posted on 2014-03-07
8
555 Views
Last Modified: 2014-03-14
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
Comment
Question by:ryanmaves
  • 4
  • 3
8 Comments
 
LVL 68

Expert Comment

by:Qlemo
ID: 39915081
Why not providing the path to Excel as Remote App?
0
 

Author Comment

by:ryanmaves
ID: 39918046
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
 
LVL 68

Expert Comment

by:Qlemo
ID: 39918137
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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:ryanmaves
ID: 39921235
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
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39921303
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
 

Author Comment

by:ryanmaves
ID: 39930512
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
 

Author Closing Comment

by:ryanmaves
ID: 39930516
Pointed me in the right direction.  Thank you.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Set OWA language and time zone in Exchange for individuals, all users or per database.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now