msonline module - where statements not working in azure functions powershell - azure-active-directory

I am trying to get a script working but any time I pipe a "where" or "Where-object" into it, I get zero results.
i.e.
$UserNames = Get-MsolUser -TenantId $tenantid -ALL | Where {($_.licenses).AccountSkuId -ilike "*$($licenseName)"} | Sort-Object DisplayName
If I run the same script locally it works perfectly fine, but just does not work in functions.
If I remove the Where statement it runs fine.
Does this need a separate syntax in azure functions, or is it a deserialization issue for MSOnline module in azure function? Not sure how to fix.
Please help

Got it working using this workaround.
https://github.com/Azure/azure-functions-powershell-worker/issues/232

Related

Starting WPF from remote PowerShell

I want to open a WPF application from remote machine using PowerShell.
This is the command I'm using
Invoke-Command -ComputerName "ComputerNamne" -ScriptBlock { & "C:\...App.exe" } -credential "Username"
but for some reason nothing happens
I was able to start the process when calling batch file which calls the applcation
Invoke-Command -ComputerName "ComputerNamne" -ScriptBlock { & "C:\...RubApp.bat" } -credential "Username"
but in this way the GUI is not appearing. I can see in task manager that the app is running though.
So two questions:
Why can't I run directly the exe file?
Why the GUI is hidden in the second method. Can I solve this?
For invoking GUI app , you have to use PSexec with -i :
You can download it from here and you will get to know how to use also.
PSTools Download
Hope it helps.
I concur with Ranadip on this one. This is not a feature of powershell, as neither WinRM nor WMI will allow you to utilize a GUI application remotely.
See a similar question:
Running remote GUI app in Powershell

Azure Insert Script - Could not find symbol 'require'

I'm just started working with BLOB Storage on Azure and I'm trying to implement Image Uploads to BLOB Storage using this tutorial for Windows Phone 8: http://www.windowsazure.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/?fb=de-de
In step 6 of this tutorial there is a insert script for a table, which needs to be set, instead of the generic one. It starts with:
var azure = require('azure');
var qs = require('querystring');
var appSettings = require('mobileservice-config').appSettings;
However, when I simply copy this script into my table's insert script i always get the error "Could not find symbol 'require'", which is weird, because it should be an azure function. Searching the web hasn't brought me any result.
Ansy suggestions?
Thank you.
The "Could not find symbol 'require'" in the Azure portal script editor is just a bug in how that environment validates the script - it shouldn't affect the actual operation of the service itself. See Phillip Van Nortwick's reply in the Azure forums.
It's likely that your InvalidOperationException is coming from other error. Have you tried calling an api with thise require()s defined and otherwise empty code?

HAproxy reqirep not working properly (missing escape?)

This is not working:
reqirep ^Host:\ beta.domain.com Host:\ beta.app-id.appspot.com
however everything is working fine if I change this reqirep to this:
reqirep ^Host:\ beta.domain.com Host:\ primary.domain.com
reqirep procedure is working correctly. In first example "app-id" is an Google App Engine application ID with "-" (dash) character.
What am I missing in the first case? I tried escaping dash ("-"), but this does not solve this issue. I am running HAproxy 1.4.8
You shouldn't need to escape the hyphen.
It sounds like you're having trouble routing to the correct server. Verify you are using the correct IP in the server endpoint.

How can I script WordPress for non-GUI automated Pages/Posts-import?

This is probably a "cannot see the forest because of the trees" situation,
but how do I create a script which does the automated import of Posts/Pages, without a hook in the WP Website-GUI (e.g. in Theme's functions.php). It should be standalone triggerable by calling the script name via webserver.
via this API-call wp_insert_post()
You want to use the WordPress API (http://codex.wordpress.org/XML-RPC_wp) to connect. You can do this with almost any scripting language, but since you mention running it on the webserver, and WordPress is written in PHP, we'll go with that language for now.
Check out this tutorial:
http://life.mysiteonline.org/archives/161-Automatic-Post-Creation-with-Wordpress,-PHP,-and-XML-RPC.html
He shows example of how to create a script that will insert a post into your WordPress blog. The script can be given execute permissions and ran via the command line or a cron job.
You will have to code the logic to get the post from wherever your data is stored, though.

cakephp: running controller action as a cron job not working

Am trying to run a controller action as a cron job, but it is giving me the message, "could not open input file"
To do the above, i used this link, http://bakery.cakephp.org/articles/view/calling-controller-actions-from-cron-and-the-command-line....
But not working for me, I also tried to place the cron dispatcher in /app/webroot, but still not working for me.
thanks...
PHP cannot load your cron_dispatcher.php. Make sure your cron entry is correct, i.e. points to the correct full path of your PHP file. Also make sure that you have your access rights correctly. It's possible that the file exists but that when PHP runs under cron, it is not allowed to read the file.
PS: Have you considered using CakePHP's Shell functionality instead of this dispatcher? It was designed for CLI use.
Call direct your action
wget http://www.example.com/homes/my
in my action wirte your code
set in cpanel ....

Resources