Load Azure PowerShell Cmdlets onto Remote VM - powershell

I am using PowerShell to automate the creation of a virtual machine in Azure, then using Remote PowerShell to run commands on that machine. I can run any PowerShell command that ships with Windows perfectly well, but when I try to run something like:
Set-AzureSubscription or Get-AzureStorageBlobContent
I get the following message:
The term 'Set-AzureSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program.
Of course, because the Azure module is not preloaded on the VM in Azure. Is it possible to copy the Azure Module up to the VM using PowerShell? Or any other way to go about this assuming everything must be automated with PowerShell (so I can't log into the VM to run the Azure PowerShell installer or copy and paste over a remote desktop session)?

Did use the Azure Powershell? If not you can install it here:
http://azure.microsoft.com/en-gb/documentation/articles/install-configure-powershell/

This is because you don't have Azure module installed
Try this to check:
Get-AzureModule Azure
You shoud get the module here:
http://azure.microsoft.com/en-us/downloads/#cmd-line-Tools

Related

Azure Powershell - Add-AzureVirtualIP cmdlet not found

I need to add another VIP for my Azure cloud service using Powershell for Azure, since there is no way to do it via the web console. In the past I was able to do it by using the Add-AzureVirtualIP command.
However, that command seems to no longer be found since MS switched everything to Azure Resource Manager mode. How can I use this command again, or is there another way to add a VIP to my cloud service?
Add-AzureVirtualIP : The term 'Add-AzureVirtualIP' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
According to your error code, it seems the Azure PowerShell is not loaded correctly. we can install Azure PowerShell with this command:
Install-Module -Name Azure
More information about Azure PowerShell, please refer to the link.

Azure Powershell agent task pipeline

I'm just wondering whats the chain underlies Azure Powershell VSO agent task. I assume that is not simple powershell host because it is not working with some commandlets (for example Get-Module -ListAvailable) and fails with an error:
The term 'Get-ServiceEndpoint' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again.
A Connected Service with name 'xxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxx' could not be found. Ensure that
this Connected Service was successfully provisioned using services tab
in Admin UI.
VSTS build task are normal powershell scripts. However the 'Get-ServiceEndpoint' is a known issue: issue.
As far as I can see other cmdlets are working normally. I've been able to write several build tasks without any problems.

Manage Azure Redis Cache with Azure PowerShell

When I try to run below command to just start with Azure Redis cache I am getting below error message. Am I missing something? I am using Windows PowerShell, Version 3.0.
PS C:> New-AzureRedisCache
New-AzureRedisCache : The term 'New-AzureRedisCache' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
You don't have all the prerequisites complete (no Azure PowerShell commands loaded). Follow the instructions at Manage Azure Redis Cache with Azure PowerShell.

Install application on remote server using local installer

I have an installation file (*.msi) which installs a service. I would like to install this service on a remote server.
Doing that via Remote Desktop is not a problem, but I cannot find a solution for doing that automatically using a batch file or a PowerShell command that would install application remotely using the local file.
What is the problem:
I have a Bamboo CI server that results in the installation file. I'd like to install the application on a remote server using the script, without copying the installation file (similar way to deploying application using the Ms Web Deploy).
Is it possible to do this in that way?
So far I have tried installutil.exe (works locally, but I cannot configure it to install it remotely), ServiceConsole, but it somehow doesn't install correctly application using create command and I can't overwrite the application.
i do that before
first download msi or exe command with invoke-webrequest like
invoke-webrequest http://mysiteapp -outfile c:\myapp.msi
then
you can install app with msiexec or some app can install like this
myapp.msi /quite
if you have telnet from server you can make script and then run...
if you have not access telnet you should use invoke-command or psexec
this link can help you
The executable to use when installing .msi files is msiexec.exe; you can call that remotely using PowerShell's Invoke-Command cmdlet, and pass it the remote path to the .msi file as a parameter (look up the msiexec.exe syntax for details).
The trick will be getting access to the .msi file on the local server from the remote PowerShell session. You will almost certainly need to create the session using CredSSP authentication, so that the remote PowerShell session created by Invoke-Command will be able to make a connection back to your local server and access the .msi file.
I hope this sets you on the right path.

Access Exchange shared folder via powershell

I need to access a public Exchange folder from my machine using PowerShell. I've found a guide saying that Get-PublicFolder is what I need, but I get this error:
The term 'Get-PublicFolder' is not recognized as a cmdlet, function, operable program, or script file. Verify the term
and try again.
Another guide suggests to add the exchange management snapin before calling it
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
but again i get no luck as it is not installed on my PC. So, what's the easiest way to cccess a public Exchange folder via PowerShell? Thanks
If your machine and the Exchange server have PowerShell v2 remoting enabled then you can create a remote session to the server and work as if you were locally on the Exchange box. Otherwise, you need to install the Exchange admin tools on your machine.