powershell use-azurehdinsightCluster specified method not suppored - powershell

Hi I am new to azure and trying to run script job on my cluster; yesterday i was able to to do map reduce streaming job successfully; however today i am stuck when trying to do hive job ; on powershell ise when i type command use-azurehdinsightcluster 'nnn' I am getting specified method not supported
also when i try script file I get error start-azure job not supported...
I I have mysettings.publishsettings file imported and in place. I have azure.psd1
I am connected to azure etc...
one thing confuses me: account name there are three account names: xxxxx#hotmail.com; and one which is similar to my storage account name , and one weird pay-as-you-go
I have tried all of them
I am totally confused please can some one help me ?

Please upgrade to the latest powershell from http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/#Install and try again.

Related

Unable to invoke web-request for script called in scheduled task for service account

We have a Powershell script which downloads some zip files from a website and we have called the script in a scheduled task.
The problem is we are not getting the zip files even after the scheduled task is finished successfully. We are using a service account for that. Running the script manually downloads the zip file without any issues. Also, for another user which we use to login into the server, the task is working fine.
The issue started after our service account got locked out because of too many failed attempts in some other system.
I have tried bypassing the execution policy but no luck.
I have tried creating a similar new task but no luck.
I tried Start-in option to provide the task the location of the script but no luck.
After too much troubleshooting, I found the error in the Powershell logs in Event Viewer. Please find the error below:
Error Message = Unable to connect to the remote server
Fully Qualified Error ID = WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
This shows that the task is unable to invoke the web request. Can this be a permission issue? If yes, then how can I provide the required access?
I troubleshooted a bit more and found that the issue is with the proxy. Can somebody tell me how can I resolve this issue? For the local user it is working fine. Even I am able to access the webpage manually through IE. Shall I import proxy settings from IE? If yes then how to do that?
I finally figured out the solution for this. I added proxy details in the script which will force the Invoke web request command to send the request to that proxy server. This thing has resolved my issue.
Regards,
Mitesh Agrawal

SQL Server EraseSystemHealthPhantomRecords() powershell method connecting to wrong instance of SQL Server

I have a SQL Server named instance that runs the standard syspolicy_purge_history job every night. The job is marked as succeeding every night, but every night on the DEFAULT instance on the same server, there is a failed login connection from the service account of the named instance.
I've tracked it down to the Erase Phantom System Health Records step of the syspolicy_purge_history job. The job uses the standard code and does not appear to have been modified in any way:
if ('$(ESCAPE_SQUOTE(INST))' -eq 'MSSQLSERVER') {$a = '\DEFAULT'} ELSE {$a = ''};
(Get-Item SQLSERVER:\SQLPolicy\$(ESCAPE_NONE(SRVR))$a).EraseSystemHealthPhantomRecords()
There are two other named instances on the same server, running the same job with the same code, and they do not generate failed login errors on the default instance.
I tried deleting the job, and recreating it by scripting the job from one of the other named instances. It made no difference.
I tried changing the code of step 3 to:
(Get-Item SQLSERVER:\SQLPolicy\[MyServerName]\[NamedInstanceName]).EraseSystemHealthPhantomRecords()
and alternatively to:
(Get-Item SQLSERVER:\SQLPolicy\[MyServerName]\[NamedInstanceName]`,[NamedInstancePort]).EraseSystemHealthPhantomRecords()
Both versions still generate the failed login on the default instance.
Both versions of the command appear to work successfully if I run them from a powershell window, and do NOT generate a failed login.
I cannot think of anything else to try. Google seems to be out of suggestions for me too.
Any ideas?

How to control window AD with rundeck

I'm looking for the best solution for automating Windows server 2012r2 via Rundeck. I'm extremely familiar with Rundeck but use it for linux vms. I've searched online for this topic but havent found anything that seems reliable. Ideally, I want to start a Runeck Job that can add users in Active Directory but not sure how to approach it. I've tried using winrm but have gotten mixed results. Ironically, it will run basic powershell commands but it errors when trying to do anything with AD. Ive even tried creating a powershell script on the AD server and have Rundeck simply execute the powershell script to no avail. Hopefully someone has had success in controlling windows nodes with Rundeck. Below is the error i receive when trying to run a powershell script.
Execution failed: 27 in project windows: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [Windows_AD_Server: NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}, ContextView(step:1, node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, Node failures: {Windows_AD_Server=[NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}, ContextView(step:1, node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, status: failed]
Firstly, PowerShell already offers a built-in way to execute jobs, with no 3rd party addons.
About Jobs
Provides information about how PowerShell background jobs run a command or expression in the background without interacting with the current session.
About Remote Jobs
Describes how to run background jobs on remote computers.
PowerShell Jobs Week: Remote Jobs
I've never heard of / used Rundeck as Paul points out as well, so this just be the Rundeck has particulars that need to be in play first. Yet, looking at the docs, and a quick youtube video on the topic, there are several things that must be in place for what you say here...
I've tried using winrm but have gotten mixed results.
… to work.
Video - Running commands remotely using the console with WinRM/WinRS
If Rundeck is similar to SCCM or Scheduled Task, then the same approach applies.
Write Your PowerShell script. have Rundeck/ScheduedTask call powershell.exe to run the script
How to execute a PowerShell script automatically using Windows task scheduler?
Also, this could very well be seen as a duplicate of this stackoverflow discussion and answer.
rundeck unable to execute powershell script with import-module
I am setting up somethin similar and have the same problem. The AD operation executes successfully, but returns exit code 1 and throw the error you mentioned. I am in the process of debugging the plugin, but it seems there is a bug within response handling.
Please check if the ad operation works although the error is thrown and please post the script block you are using to control the AD.
Edit: in meantime I was able to narrow down the issue and opened an issue with the project: github
I provisionally fixed the issue with adding the following line in winrm-session.py after line 89:
new_msg = msg
The line before is:
" error message: %s" % (e))
The line after is:
else:
If this does not solve your issue, please post your script block.
Best Tobias

VSTA- Deployment group , add new Machines with PowerShell script

I am trying to add machines to Deployment group. I have executed the given Power-Shell script on the Azure host.
* I ticked the "Use the personal token ..." just in case.
** The script is auto generated by VSTS (azure).
but the script stops responding after 1 minute or so, as you see in the below image.
FYI:
I'm an admin on the VM as well as in VSTS.
after a little googling , look like I have to get somewhere like the below picture, but the script doesn't get there.
Notice: I don't get to the below screenshot !

TFS Build "PowerShell on Target Machines" Step Fails: How to debug?

I'm trying to automate the deployment of the solution my team is working on through TFS Build server. One of the steps which executes a PowerShell script on the target machine fails with the following error:
Microsoft ODBC Driver 11 for SQL Server : Login failed for user 'sa'..
The PowerShell script I'm trying to execute does in fact connect to multiple databases using the sa credentials. When I try to execute the same script passing it the exact same arguments by hand (i.e: executing the script from the target machine VM itself) it works like a charm. But when it is being executed as part of the build steps it fails with the aforementioned error.
Is there a way to further debug the issue? It would be great if there is a way to output trace statements from the script so I could have some insight on what is actually going on.
Usually all the related error should reflect in TFS build log. To narrow your issue you can try to connect to the TFS build agent with the credentials used for the build service and manually run the ps script.
If you execute the ps script with your own account, which will not help to the issue. Usually this kind of problems is related to permissions. Your build service account are lack of related permission. Try to add it to Administrator or SQL Administrator group and execute the build again.