Hyper-v Export-VM : Provider load failure error in 2012r2 - powershell

I'm using powershell 4 to export all the VMs in hyper-V and move it to a backup server(nas unix). Export was successful for few VMs and after a while it fails with the following errors:
Export-VM : Provider load failure
At C:\scripts\test.ps1:37 char:5
Export-VM -Name $vmname -Path $ExportPath
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Export-VM], ManagementException
FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.ExportVMCommand
This is the error i get in event viewer:
The description for Event ID 18350 from source Microsoft-Windows-Hyper-V-VMMS cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
71706037-090D-4B74-BB0B-AEE96D47D898
%%2147942432
0x80070020
The locale specific resource for the desired message is not present
The same script works fine in windows 2016 server running powershell 5. I'm not sure if this is OS specific or it has to do with any updates. Please share your view on this and help me resolve this issue.
Update
I also get this Error:
Get-VM : Quota violation
At line:1 char:1
+ Get-VM
+ ~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VM], ManagementException
+ FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.GetVMCommand

This issue occurred because Hyper-V service became unresponsive. Restarting Windows Management Instrumentation service or hyper-v service fixed this issue.

Related

Trying to use BitsTransfer (Powershell) or bitsadmin to transfer files when booted into WinRE

Trying to use BitsTransfer (Powershell) or bitsadmin to transfer files when booted into WinRE.
I am able to get the file using invoke-webrequest for the same paths. None of the Bits commands give much information other than "The device is not ready". My searches only return information on Windows update.
I have tried restarting services.
When I run Start-BitsTransfer I get:
VERBOSE: Performing the operation "New" on target "BitsTransfer".
Start-BitsTransfer : The device is not ready.
The device is not ready.
At line:1 char:1
Start-BitsTransfer "http://...Source...
+ CategoryInfo : NotSpecified: (:) [Start-BitsTransfer], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
Get-BitsTransfer command gives me:
get-bitstransfer : The device is not ready.
The device is not ready.
At line:1 char:1
get-bitstransfer
+ CategoryInfo : NotSpecified: (:) [Get-BitsTransfer], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.BackgroundIntelligentTransfer.Management.GetBitsTransfer
BitsAdmin.exe gives me:
BITSADMIN version 3.0
BITS administration utility.
(C) Copyright Microsoft Corp.
Unable to connect to BITS - 0x80070015
The device is not ready.

Copy-Item throws Null reference exception

I am trying to copy a file from Guest Linux VM to Host Hyper V windows machine.
I am using powershell to copy the file from guest vm(linux) to Host(windows).
Write-Host "$session, $TestLogPath, $destLogs" #all variables are valid and not null
Copy-Item -FromSession $session -Path $TestLogPath/Test.txt -Destination $destLogs
I get the following error while doing that:
Object reference not set to an instance of an object.
+ CategoryInfo : NotSpecified: (:) [Copy-Item], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.CopyItemCommand
+ PSComputerName : 10.218.10.13
I am not sure what this error is since the desired file is copied successfully from Linux VM to Windows Host.
Any one has any idea why this error is shown despite file copied successfully from Linux VM to Host machine.

Grant-CsTeamsAppPermissionPolicy not working in microsoft teams powershell

I am trying to apply permission policy to a user via powershell but it is not working
PS C:\Users\PO30261> Grant-CsTeamsAppPermissionPolicy -PolicyName "HR App Policy" -Identity d72f6b50-ac75-470a-80b8-919ab8b3232e
Get-CsOnlineSession : Connecting to remote server api.interfaces.records.teams.microsoft.com failed with the following error message : The WinRM client cannot process the request. Basic
authentication is currently disabled in the client configuration. Change the client configuration and try the request again. For more information, see the about_Remote_Troubleshooting Help
topic.
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:63 char:22
$remoteSession = & (Get-CsOnlineSessionCommand)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Get-CsOnlineSession], PSRemotingTransportException
FullyQualifiedErrorId : PSRemotingTransportException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsOnlineSession
Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:19581 char:38
... -Session (Get-PSImplicitRemotingSession -CommandName 'Grant-CsTeam ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
Error shows that issue is not related to apply policy. Issue is with connecting to server "Basic authentication is currently disabled in the client configuration" so update module and try again. Update-Module MicrosoftTeams
Seems like a problem with powerShell version. Look at this discussion where community are following this issue, including me:
https://techcommunity.microsoft.com/t5/teams-developer/authenticating-with-an-access-token-connect-microsoftteams/m-p/2233794

Error Creating New VMs using PowerShell

I'm struggling to create a new virtual machine on Hyper-V using a simple example from the help file. I can create VMs manually using the GUI but I was trying to learn how to do this using PowerShell but I'm getting the error below.
New-VM -Name "base" -MemoryStartupBytes 1GB -NewVHDPath "J:\Hyper-V machines\dc.vhdx" -NewVHDSizeBytes 100GB
Error Message:
New-VM : Failed to create a new virtual machine. 'base' failed to realize.
(Virtual machine ID 80967A7D-7380-4771-B200-99129D63496C) Failed to access
configuration store: The device is not ready. (0x80070015).
At line:1 char:1
+ New-VM -Name "base" -MemoryStartupBytes 1GB -NewVHDPath J:\VM\base.vh ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VM], VirtualizationExcept ion
+ FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.NewVM
My VMs are located in an external harddrive and the path exists ...there's not much help about this error online.

Error to execute DSC when create virtual machine in azure

I create in powershell Virtual Machine Windows 8.1 in azure. And Set-Azure DSC. But I see error, during execute DSC:
[10/21/2014 14:17:39.44] Executing: C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\bin\install.cmd
[10/21/2014 14:17:47.24] Execution Complete.
#
Execution Output:
Execution Error:
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\bin\install.ps1 : File
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\bin\install.ps1 cannot be
loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\bin\install.ps1 -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
How can I enable security policy during create VM in powershell?