need Test-MigrationServerAvailability - powershell

Need Test-MigrationServerAvailability
The following reference it but never say where to download it
http://office.microsoft.com/client/15/help/preview?AssetId=HA102908370&lcid=1033&NS=O365PROADMIN&Version=15&CTT=5&origin=HA103169067
http://technet.microsoft.com/en-us/library/jj874015(v=exchg.150).aspx
PS C:\Users\user> Test-MigrationServerAvailability
Test-MigrationServerAvailability : The term 'Test-MigrationServerAvailability' 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.
At line:1 char:1
+ Test-MigrationServerAvailability
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-MigrationServerAvailability:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Using Bing instead of Google the answer was readily available.
http://www.wadeware.net/it-infrastructure/migrating-from-third-party-providers-to-office-365-imap4-example-2/

You must be connected to an Exchange server.
Install-Module -Name ExchangeOnlineManagement -RoquiredVersion 2.0.3
Get-ExecutionPolicy -List
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserprincipalName admin#company.com -showprogress $ True
Disconnect-ExchangeOnline

Related

Get-Command : The term 'Get-AzStorageBlobContent' is not recognized as the name of a cmdlet, function, script file, or operable program

From my question about installing Azure Powershell
I was able to install Azure Powershell 5.1
However when I try to run
Get-Command Get-AzStorageBlobContent
I get
Get-Command : The term 'Get-AzStorageBlobContent' 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.
At line:1 char:1
+ Get-Command Get-AzStorageBlobContent
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzStorageBlobContent:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
I can see the commands listed in the right panel of ISE and I get intellisence help
The link 135170 takes me here
Get-ExecutionPolicy
returns Restricted
You could run set-executionpolicy remotesigned as administrator to fix the issue.
See: https://www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/

Running Invoke-AzureRmVMRunCommand through Azure automation

I am trying to run a script thorugh Invoke-AzureRmVMRunCommand from azure automation but it is showing cmdlet does not exist. Please let me know how to implement this.
Below the script
Invoke-AzureRMVMRunCommand -ResourceGroup 'XXXXXX' -Name XXXXX-CommandID 'RunPowerShellScript' -ScriptPath 'Test.ps1'
Error details.
Invoke-AzureRMVMRunCommand : The term 'Invoke-AzureRMVMRunCommand' 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.
At line:1 char:1
+ Invoke-AzureRMVMRunCommand -ResourceGroup 'olf3em-rds-mgmt' -Name OLF ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-AzureRMVMRunCommand:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
You need to install modules before using those:
https://learn.microsoft.com/en-us/azure/automation/automation-runbook-gallery#modules-in-powershell-gallery
in short:
go to modules
browse gallery
install
The Invoke-AzureRmVMRunCommand command is included in the AzureRM.Compute module. Which you will first need to install in your Automation Account.

Install PowerShellGet module

I am working on Windows 2012 R2 and it was running PowerShell version 4.0. I have upgraded to version 5.0.
It seems like that when I do basic commands I get errors, for example,
PS C:\Windows\system32> Install-Module –Name PowerShellGet –Force –Verbose
Install-Module : The 'Install-Module' command was found in the module
'PowerShellGet', but the module could not be loaded. For more
information, run 'Import-Module PowerShellGet'. At line:1 char:1
+ Install-Module –Name PowerShellGet –Force –Verbose
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Another example:
PS C:\Windows\system32> import-module PowerShellGet
Get-Variable : The term 'Get-Variable' 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. At C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\1.1.3.2\PSModule.psm1:18
char:28
+ $script:IsWindows = (-not (Get-Variable -Name IsWindows -ErrorAction ...
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Variable:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I am basically following the installation method for PowerShellGet found here: https://learn.microsoft.com/en-us/powershell/gallery/psget/get_psget_module
I am stuck at the "Install-Module" command in this guide.
Execute the command on your powershell: 'Set-ExecutionPolicy Unrestricted' before executing install-module.
(The restricted mode helps you protect from the the unauthorized scripts)
I know I too late to answer this question. But may help to others.
Try following ,
Set-ExecutionPolicy Unrestricted
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
and now you can try install-module
This didn't work for me
PS C:\temp> Set-PSRepository -NAME PSGallery -InstallationPolicy Trusted
PackageManagement\Get-PackageProvider : The term 'PackageManagement\Get-PackageProvider' 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.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:2934 char:26
... $nugetProvider = PackageManagement\Get-PackageProvider -ErrorA ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (PackageManagement\Get-PackageProvider:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
PackageManagement\Get-PackageProvider : The term 'PackageManagement\Get-PackageProvider' 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.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:2948 char:40
... ailableNugetProviders = PackageManagement\Get-PackageProvider -Name $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (PackageManagement\Get-PackageProvider:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
PackageManagement\Install-PackageProvider : The term 'PackageManagement\Install-PackageProvider' 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.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:3138 char:21
$null = PackageManagement\Install-PackageProvider -Name $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (PackageManageme...PackageProvider:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
PackageManagement\Import-PackageProvider : The term 'PackageManagement\Import-PackageProvider' 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.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:3144 char:21
$null = PackageManagement\Import-PackageProvider -Name $s ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (PackageManagement\Import-PackageProvider:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
PackageManagement\Get-PackageProvider : The term 'PackageManagement\Get-PackageProvider' 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.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:3148 char:30
... $nugetProvider = PackageManagement\Get-PackageProvider -Name $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (PackageManagement\Get-PackageProvider:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
Set-PSRepository : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.
At line:1 char:1
Set-PSRepository -NAME PSGallery -InstallationPolicy Trusted
+ CategoryInfo : InvalidOperation: (:) [Set-PSRepository], InvalidOperationException
+ FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Set-PSRepository
PS C:\temp>

Azure Powershell - Switch-AzureMode error in version 1

Hello I am not powershell programmer and I learning right now using pluralsight and exericese file giving me error and I think it happening because or version change of Azure Powershell from 0.9.8 to version 1.0
Here is error :
c:\Pluralsight\chef\2-chef> .\Create-CourseEnvironmentARM.ps1
Switch-AzureMode : The term 'Switch-AzureMode' 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.
At C:\Pluralsight\chef\2-chef\Create-CourseEnvironmentARM.ps1:28 char:1
+ Switch-AzureMode AzureResourceManager -Verbose
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Switch-AzureMode:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Test-AzureResourceGroup : The term 'Test-AzureResourceGroup' 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.
At C:\Pluralsight\chef\2-chef\Create-CourseEnvironmentARM.ps1:32 char:5
+ if((Test-AzureResourceGroup -ResourceGroupName $GroupName) -eq $false){
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-AzureResourceGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
New-AzureResourceGroupDeployment : The term 'New-AzureResourceGroupDeployment' 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.
At C:\Pluralsight\chef\2-chef\Create-CourseEnvironmentARM.ps1:44 char:1
+ New-AzureResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-AzureResourceGroupDeployment:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
File Name :.\Create-CourseEnvironmentARM.ps1
I was searching error in google and confirm that azure power shell
deprecate function "Switch-AzureMode AzureResourceManager -Verbose"
https://github.com/Azure/azure-powershell/wiki/Deprecation-of-Switch-AzureMode-in-Azure-PowerShell
Switch-AzureMode AzureResourceManager -Verbose
Here is code from Create-CourseEnvironmentARM.ps1
Switch-AzureMode AzureResourceManager -Verbose
### Create Resource Group ###
if((Test-AzureResourceGroup -ResourceGroupName $GroupName) -eq $false){
New-AzureResourceGroup -Name $GroupName -Location $Location -Verbose
$ResourceGroup = Get-AzureResourceGroup -Name $GroupName
}
else {$ResourceGroup = Get-AzureResourceGroup -Name $GroupName}
$parameters = #{
'newStorageAccountName'="$StorageName";
'adminUsername'="$AdminUsername";
'dnsNameForPublicIP'="$PublicDNSName"
}
New-AzureResourceGroupDeployment `
-Name $DeploymentName `
-ResourceGroupName $ResourceGroup.ResourceGroupName `
-TemplateFile azuredeploy.json `
-TemplateParameterObject $parameters `
-Verbose
Please help me to correct this code. I think author is never update course and I am in middle of course. I hope someone help me to fix this problem.
There is no more "Switch-AzureMode" since v. 1.0.0 of the Powershell.
The ARM and ASM cmdlets exists together and live together. The ASM cmdlets are with unchanged names, but the ARM cmdlets are all now with RM in their name. Like:
Add-AzureRmAccount
Both the powershell cmdlets can be installed via Web Platform Installer.
More, when on Windows 10, the ARM cmdlets can be installed via PowerShell Gallery using the ofllowing commands (under Aministrative PowerShell console):
Install-Module AzureRM
Confirm all the questions being asked. Then run the
Install-AzureRM
Then you are done with the ARM module. Just make sure that your local execution policy is at least "RemoteSigned".
At the end, you will have to edit all your PowerShell scripts to match the new cmdlets and their parameters. Like the New-AzureResourceGroup is now New-AzureRmResourceGroup: https://msdn.microsoft.com/en-us/library/mt603739.aspx

The term 'Rename-Computer' is not recognized as the name of a cmdlet

I want to rename the computer with PowerShell 2.0 in Windows 7 Sp1, but it got an error.
PS C:\Windows\system32> Rename-Computer -NewName PC02
The term 'Rename-Computer' is not recognized as the name of a cmdlet, function, script f
ile, or operable program. Check the spelling of the name, or if a path was included, ver
ify that the path is correct and try again.
At line:1 char:16
+ Rename-Computer <<<< -NewName PC02
+ CategoryInfo : ObjectNotFound: (Rename-Computer:String) [], CommandNotFo
undException
+ FullyQualifiedErrorId : CommandNotFoundException
That's because Rename-Computer was introduced in Powershell 3.0
To do this in PowerShell 2.0, use WMI:
(Get-WmiObject Win32_ComputerSystem).Rename('PC02')
You can rename a remote computer by adding -ComputerName CURRENTNAME after Get-WmiObject.
You must do this from an elevated prompt. This will, of course, require a reboot to take effect.