Open Excel File on Azure VM with Powershell Script Sent from Local Computer - azure

Can someone show how I can open an Excel document and show it visually on an Azure virtual machine using a Powershell script sent from my local machine? I have already figured out how to run Powershell script on the VM through the AzureVM module but am running into the issue of Windows not allowing remote Powershell users to interact with a user interface. Notes:
I have tried PSEXEC with no luck. This may be the way to go, but I have had no luck getting it to actually work.
I am not smart, so please use the most dumbed-down terminology as possible.
My end goal is exactly that stated above - nothing more nothing less.
Riches and honor to the one who can solve this.

Related

Setting desktop backgrounds via Azure Storage Containers using PowerShell not working

I'm trying to set desktop backgrounds for our users from Azure Storage using a PS script I'm hoping to deploy.
This script
It just isn't working!
For whatever reason, the script just stops calling at a certain point (line 142 onwards) and I can't work out why.
I've added Write-Hosts at certain points to see where it's getting to and it seems to be that return $Bloblist which doesn't run or go any further.
I can see from the logs that it's showing 'Adding content file from Azure Storage Blob to return list: Background-01.png' etc., but that's it. This tells me that is not a permission error as it is looking where it needs to.
I just can't work out why it's not returning that Bloblist.
If anyone could help that'd be super, as we need to change the desktop backgrounds for every user in the company due to a company name change.
Thanks a lot!
The problem is (probably) not with the script. The problem is likely due to a setup misstep.
You need to debug the code and find out where it's failing to do what you expect.
You could try this or if videos are your thing you could try this.

Deploy an Uipath in an Azure virtual machine

I have created a VM with the free trial account of Azure with a basic components and a Windows 10. I have installed last version of UiPath and it is working fine, but when I close the RDP connetion (clicking in the "X"), the running execution failed.
I think it is because the selectors does not work when the "screen" is displayed. But I don't know how to keep the VM as if it was displayed to avoid the fail of the execution when I close it.
Any advice?
Thanks in advance :)
You will have to either:
Run your process on an unattended robot
or
Run attended and keep the RDP open
As Mads T said above you have 2 options when running process on a Virtual Machine.
Attended
You need to remain logged into RDP for this to work
Unattended
Do you have an instance of Orchestrator, you can use the free community version UiPath offer at https://cloud.uipath.com/
From Orchestrator you can start your process on the Virtual Machine without having it open.connected to via RDP
UiPath has more documentation on this subject here https://docs.uipath.com/orchestrator/docs/attended-vs-unattended-automation

Azure Classic VM. How to fix Error: "We couldn't complete the updates. Undoing changes. Don't turn off your computer."

An automated Windows update this morning left my Windows Server 2012 R2 Classic Virtual Machine on Azure in a semi-crashed state. The VM is a web server, and all the files and applications in it are still accessible via the browser. In other words, IIS and a number of other services are still running. Unfortunately, however, the VM is not accessible via Remote Desktop and is unresponsive to commands from the Azure management interface on the portal.azure.com website.
This type of error is quite common and can be found reported on many other websites. The error has been happening to Windows users (not just Windows Server) for many years already, and none of the solutions online will work for Azure users, because they involve restarting from a CD, pressing shift-f8 during boot, issuing DOS commands, restoring from backup, or unchecking certain properties in VMWare or other software.
Does anybody have a real solution for this problem on Microsoft Azure?
After struggling with this for weeks, I think I was able to fix this with the help of Microsoft support! I decide to post the solution here in case it can help someone in the future. Here are the three things that you need to do to fix this:
1-Restore the VM from a backup prior to the crash. The VM with the "Undoing Changes" crash is pretty much toast at this point. Now, proceed to steps 2 and 3 to ensure that the next batch of Windows Updates won't crash it again!
2-On your new VM, ensure that the Environment Variables for TEMP and TMP both point to C:\Windows\TEMP. In my case, they were both pointing to a temporary folder in the logged in user's profile.
3-Ensure that C:\Windows\TEMP is always empty. I achieved this by setting up a scheduled task that runs a simple BAT file that deletes all files and folders inside of the C:\Windows\TEMP once a day. I spoke with a Microsoft representative who said that even though you may have plenty of hard drive space in your C:\ drive, the Windows TEMP folder is really not supposed to get much bigger than 500MB. When it gets very large you may have some issues with Windows Updates (mine was just under 500MB when the updates were failing).
I would recommend contacting Azure support as something may have to be done by an engineer to fix the issue and unfortunately classic VMs don't have the redeploy feature.
I've added only InboundPort 3389 RPD, and works well now.

Azure Powershell Linux

Are there any more cmdlets for Linux Azure Powershell apart from these?
Is there an official repository for Azure Powershell for Linux?
Is there a way for terminal to launch powershell on startup, not bash?
My google-fu is weak today :(
Your question is old but I'll still answer it. In hopes that you will receive my response via email, others seeking help in the future will see this, and to establish reputation on this damn site so I can actually start using it effectively.
Are there any more cmdlets for Linux Azure Powershell apart from these?
I assume you're specifically looking for Azure because of your title. AzureRM.Netcore has been released as of ~1 month ago. This supports 90% of the functionality you need to deploy to Azure.
https://www.powershellgallery.com/packages/AzureRM.Netcore/0.9.1
Unfortunately, I am finding that some older cmdlets are not supported yet though, since they are in an older module called Azure, which does not yet have a .NET Core implementation. See my recent post for more information on that.
Is there an official repository for Azure Powershell for Linux?
You can find all of that discussion on the official Powershell repository. It is cross-platform. Additionally Microsoft intends to build Powershell 6 on top of .NET Core 2.0 which was released yesterday. So it's likely that future development will heavily support Linux. This will be your best resource: https://github.com/Azure/azure-powershell
Is there a way for terminal to launch powershell on startup, not bash?
There is. But I wouldn't recommend doing that. That just sounds wrong. But I'm a pretentious Linux user with a bias towards Microsoft so take my opinion with a grain of salt. There are two methods you can use to accomplish that.
1) Most Linux distros come with a command called chsh just for that. Try chsh -s /usr/bin/powershell provide that is the location of your installed Powershell binary. If you are not sure where it is, you can use which to determine the installation location. which powershell. Do not execute this command with sudo as that will attempt to change the shell for your root user rather than your current user.
2) Alternatively you can manually edit the file /etc/passwd on Linux. Locate the line that contains your user account, go to the very end of it, and replace /bin/bash or whatever shell you use with /usr/bin/powershell, or the proper location of your Powershell Binary.

run sharepoint powershell from c# on another PC?

If the C# application is on the same server as sharepoint, I know we can use RunSpace to run the pwoershell script, but what if the C# app. and sharepoint server are on different PCs?
Is this possible?
thanks
yes, its possible, though messy. In Powershell 2.0+, there's a feature called remote powershell, so you can effectively, via c# code, send Powershell commands to your local powershell instance, and use that to log into the remote instance.
A slightly less insane idea would be to simply create a web service on the remote machine, and have that run the remote powershell commands, from the web service.
And even less crazy idea is just to write a web service, and have that run code on the remote server. : )
Good luck!
If you are administrator on the remote box, you can try combining PsExec and PowerShell.

Resources