Error to execute DSC when create virtual machine in azure - powershell

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?

Related

Installing CCM client on PC via powershell

I'm trying to speed up how soon SCCM recognises a device on the domain and starts the process of installing applications.
I have the below in powershell
$CCMInstallerPath = "\\ServerFQDN\SMS_MAN\Client\ccmsetup.exe"
$args = "/mp:MPServer", "/LOGON", "/UsePKICert", "SMSSLP=SMSSLPServer", "SMSSITECODE=MAN"
& $CCMInstallerPath $args
I get the below error:
Program 'ccmsetup.exe' failed to run: Access is deniedAt line:1 char:5
+ & $CCMInstallerPath $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:5
+ & $CCMInstallerPath $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
I have read and execute access to this file, both by group and directly by name
I have also tried:
Start-Process -FilePath \\ServerFQDN\SMS_MAN\Client\ccmsetup.exe -ArgumentList "/mp:MPServer", "/logon SMSSITECODE-MAN", "/UsePKICert"
and get the error
Start-Process : This command cannot be run due to the error: Access is denied.
At line:1 char:5
+ Start-Process -FilePath \\ServerFQDN\SMS_MAN\Client\c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
ServerFQDN is a replacement for one of our NM servers
I can fully connect to the folder and run the exe manually
I am running elevated powershell
Issue was caused by incorrect share permissions found in effective access.
Permission was granted to run the file but effective access was showing differences

Windows cmdlet over powershell passes but gives access denied over winrm for Cluster aware updating

I am executing Invoke-CACURun for windows cluster aware updating on domain controller as an administrator. While that works on powershell, it is failing over ansible with ntlm transport and same credentials.
The command executed
ansible domain_controller -i ansible_hosts -m win_shell -a 'whoami;Invoke-CauRun -ClusterName "xyzWFC
The error I get is
Invoke-CauRun : Could not open cluster "xyzWFC": (Win32Exception) Access is denied
At line:1 char:72
+ ... .UTF8Encoding $false; whoami;Invoke-CauRun -ClusterName "xyzWFC";
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Invoke-CauRun], CauAccessDeniedException
+ FullyQualifiedErrorId : OpenClusterAccessDenied,Microsoft.ClusterAwareUpdating.Commands.InvokeCauRunCommandnon-zero return code
Any help on this?

Get-PSRepository commands giving two outputs with two Powershell ISE

When i run Get-PSRepository using Powershell ISE(x86) it shows me the source location and installation policy as trusted. The source location it shows is https://www.powershellgallery.com/api/v2
But when i run the same command using Powershell ISE without the x86 from my machine i get the below error:
Get-PSRepository : The 'Get-PSRepository' 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
+ Get-PSRepository
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PSRepository:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Why powershell is displaying the two behaviours with two different ISE is it because of environment variable or what?

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

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.

Azure PowerShell will not connect

I have downloaded and installed the Azure Powershell by following the MS instructions:
https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
Using the Windows Powershell ISE I run the command:
Login-AzureRmAccount
which returns the the error:
Login-AzureRmAccount : The 'Login-AzureRmAccount' command was found in the module 'AzureRM.Profile', but the module could not be loaded. For more information, run 'Import-Module AzureRM.Profile'. At line:1 char:1
+ Login-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Login-AzureRmAccount:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Import-Module AzureRM.Profile
Returns this error:
Import-Module : File C:\Program Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\CheckVersions.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
+ Import-Module AzureRM.Profile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
Why is it so difficult to connect to Azure, what could be wrong?
From the command prompt run:
powershell Set-ExecutionPolicy RemoteSigned