Project Centennial: How to edit outputted XML and call MakeAppx.exe - powershell

I’m running into this error while trying to convert my Windows Forms Application using Project Centennial. I was able to run threw the shown VLC tutorial on the MSDN site, so I do know the converter is working. It says I need to “set the 'Application Executable' property in the AppxManifest.xml before calling makeappx manually” but I am not sure how to do that. I have tried using -AppExecutable but it’s not setting, every time it builds it defaults to MyApp.exe. It says I can edit it, but when I do not know how to call MakeAppx.exe with the same XML file.
Here is the command I am using:
.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14393 –Installer C:\Users\Mark\Desktop\Newest_Installer\Keyed-Setup.exe -InstallerArguments "/S" -Destination C:\Users\Mark\Desktop\Keyed_App_Filers -PackageName "Keyed" -Publisher "CN=JonesComm" -Version 1.0.2.2 -AppExecutable "KeyedApp.exe" -MakeAppx -Verbose
Here is a picture of the full error.
Error Pic
Thanks in advance for any help you can offer!

Eureka!!! Okay so for about a week solid I have not been able to get this right. I have an MSI and a .exe of my program and I just successfully wrapped the .aapx with the MSI. The command that lead to the break though was “msiexec /?” this shows a list of the commands specifically for that application. “/PASSIVE” is the command needed to run without UI. I was able to set the 'Application Executable' property with “-AppExecutable "Executable(.exe) File Path"-AppInstallPath "Your Applications Installation Path” This is just the name of your applications executable, and where that executable would be located on a new computer after a fresh install.
Here is an editable version of the powershell command I used:
.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14393 –Installer C:\Users \Desktop\MyApp\MyApp_Setup.msi -InstallerArguments "/PASSIVE" -Destination C:\Users\Desktop\MyApp-Appx -PackageName "MyApp" -Publisher "CN=Company" -Version 1.0.2.2 -AppExecutable "ApplicationFolder\SubFolder\MyApp.exe"-AppInstallPath "C:\Program Files (x86)\ApplicationFolder\SubFolder" -MakeAppx -Verbose
I hope this helps any newbies out there like me. Project Centennial doesn’t have much for tutorials out there right now. Thanks everyone!!

Related

New-IISSiteBinding says website does not exist, while it does

For a project I'm working on I want to export IIS bindings and then import them back using PowerShell. The export part is working, but now I want to import the IIS site bindings back into IIS. I'm using the New-IISSiteBinding command in order to import them like this:
New-IISSiteBinding -Name "Portal" -BindingInformation "*:443:domainname.com" -CertificateThumbPrint "theactualthumbprint" -CertStoreLocation "Cert:\LocalMachine\My" -Protocol https
When running the command it says WARNING: Web site 'Portal' does not exist.. Get-IISSite is returning the same result. When I look in the IIS management console, I do see the site with that name.
Why is it saying that the Web site does not exist when it actually does?
It was actually PowerShell ISE that was the issue. When I executed the scripts in a separate PowerShell window it was working fine and importing the binding. I wasn't aware that ISE is no longer actively maintained, so that's probably why my command wasn't working.

The Win32 internal error "The handle is invalid" 0x6 occurred while getting the console mode

I currently have some problems with the azure commandline in a Web App.
I get following error:
[10/28/2015 20:22:33 > 37539e: ERR ] New-Item : The Win32 internal error "The handle is invalid" 0x6 occurred while
[10/28/2015 20:22:33 > 37539e: ERR ] getting the console mode. Contact Microsoft Customer Support Services.
This occurred on New-Item and Remove-Item. It happens in the Kudo Powershell console and using Powershell-Scripts ina WebJob.
Instead of New-Item file I have successfully used echo 3 >> file. This worked without problems. The only thing I found was that there is a problem using Invoke-WebRequst and that it will be fixed using
$ProgressPreference="SilentlyContinue"
Unfortunately this didn't helped.
Did someone experienced something similar?
Thanks in advance.
Some cmdlets may attempt to read the console mode of the standard input or standard output streams if it is attached to the console. This can be avoided by setting them explicitly to null.
# Prevent the progress meter from trying to access the console mode
$ProgressPreference = "SilentlyContinue"
# Set the input and output streams to $null
$null | Invoke-WebRequest -UseBasicParsing http://www.example.com/ > $null
For me, setting $ProgressPreference="SilentlyContinue" does solve the issue.
(Using the PowerShell Console of the Kudu site of an Azure App Service.)
$null | (…) > $null also prevents the error, but that also suppresses the return value, which I don't want.
Background: Apparently Invoke-WebRequest tries to display a progress bar, which Kudu's PowerShell does not support. (source)
The error seems to be related to the protection of our proprietary sandbox for Web Apps. However, one possibility is to use Windows Containers on App Service.
Here you can follow the quickstart to run a Windows Container in App Service:
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-windows-container

Enable XA Transactions through a batch file or script

Im trying to create a batch file or a script that enables this option in Windows 7x64
The reason for this is that when running a silent installation I get en error pointing to this. If I do it manually all works fine.
Im not sure how to create this batchfile/script/powershell...?
Any ideas?
Thank you all
The option 'sits' in the registry according to MSDN - http://msdn.microsoft.com/en-us/library/cc224817.aspx
With PowerShell it will be like this:
Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\MSDTC\\Security\\" -Name "XaTransactions" -Value "1"
Note that you need admin rights. Tried it on Windows 8.
You may want to experiment with reading the value first - here's the way:
Get-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\MSDTC\\Security\\" -Name "XaTransactions"

Powershell get latest on a working folder?

I am trying to get latest on a specific folder and was wondering how I would do this. I have been reading the MSDN documentation about the Workspace class but unfortunately it doesn't seem to provide any information about how I would go about getting latest of a specific folder.
For example, I have a single workspace but with multiple working folders. My PowerShell script can get latest but only at workspace level. Is it possible to get it from a working directory level or at a particular folder level?
Thanks in advance, DS.
EDIT
I believe this is possible as power tools is able to do it via right clicking a folder and getting latest. Ideally, want to replicate this.
http://msdn.microsoft.com/en-us/library/Microsoft.TeamFoundation.VersionControl.Client.Workspace.aspx
The below shows my script in practice..
$tfs = .\tfs-get-instance.ps1 -uri $uri
$vcs = $tfs.TfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
[psobject]$workspace = $vcs.GetWorkspace([System.Environment]::MachineName, [System.Environment]::UserName)
$workspace.Map($sourceFolder, $localFolder)
$result = $workspace.GetLocalItemForServerItem($sourceFolder);
if ($result -ne "")
{
echo $result
}
You should be able to use the Workspace.Get Method (String[], VersionSpec, RecursionType, GetOptions) to get what you want.
On the other hand, if you don't necessarily want to do it using the .NET objects, you could let tf.exe do the actual work, like the following:
& $TfExePath workfold /map "$codePath" "$LocalFolderPath" /collection:"$tfCollection" /workspace:$workspaceName
& $TfExePath get "$codePath" /version:$ChangeSet /force /overwrite /all /recursive $workspaceName
On the other hand, if you have the TF PowerTools installed you should also have PowerShell cmdlets for working with TFS. I have never used them, but I'm guessing you should be able to use them instead of using tf.exe if you want to. I would probably go for the PowerShell cmdlets in the power tools if they fill your need.

Create-Fixture in Pester (Powershell BDD) isn't working

I'm following the instructions from here:
http://scottmuc.com/blog/development/pester-bdd-for-the-system-administrator/
I'm finding that having installed and imported the module I still can't run Create-Fixture.
Has anyone come across this?
Turns out Create-Fixture isn't a cmdlet any more. I had a look here:
https://github.com/mwrock/Chocolatey-Packages/blob/master/pester/Pester.psm1
and realised the name of the cmdlet has been changed. It's now called New-Fixture.
If you run New-Fixture it even references Create-Fixture:
PS D:\edsource\Powershell> New-Fixture
invalid usage, please specify (path, name)
eg: .\Create-Fixture -Path Foo -Name Bar
creates .\Foo\Bar.ps1 and .\Foo.Bar.Tests.ps1