Windows Update API - Report Client Status - c#

I have an application that uses WSUS client API to download and install updates. I have been trying to figure out how to report the client's status to the server once installs are complete, without having to run: wuauclt /detectnow from the command line.
The update log in C:\Windows\WindowsUpdate.txt does show the reporting event: 0 Success Pre-Deployment Check Reporting Client Status
So it seems that there is a way to report the status, I just can't find it in the API documentation.

I don't really know much about these APIs (maybe it would be helpful if you clarify what exactly you're doing), but this looks promising:
From the Windows Update Agent (WUA) API Reference:
IDownloadProgress InterfaceSeems like you can obtain this from IDownloadJob::GetProgress
IInstallationProgress InterfaceSeems like you can obtain this from IInstallationJob::GetProgress
If you don't want to keep polling these objects for new progress, it looks like there is also the following, which your code can implement:
IDownloadCompletedCallback
IDownloadProgressChangedCallback
IInstallationCompletedCallback
IInstallationProgressChangedCallback
I don't know if this is what you're asking for, but this is my guess. Hope that helps.

Related

ExampleAssistantV1 with IBM Watson Unity SDK

I have attached the ExampleAssistantV1.cs script to a character in Unity and obtained my services credentials (API key and service URL) from the Assistant I have created.
From my dialog page, I can only see/get my Assistant Name and Assistant ID, but nothing like Workspace ID. I have searched around my bluemix pages and account details for the Assistant service, but cannot seem to find anything about Workspace. Where is this?
The version date when I used Tone Analyzer in Unity worked with the current date (yesterday) so I wonder if the same applies to Assistant? In the code comments, there is no explanation of what this date actually is...
When I run Unity, I get the following error. I could only find two threads on this; both are closed now on GitHub. Could someone please help me understand what I am missing?
[RESTConnector.ProcessRequestQueue()][ERROR] URL: https://gateway-lon.watsonplatform.net/assistant/api/v1/workspaces//message?version=2018-12-27, ErrorCode: 400, Error: 400 Bad Request, Response: {"error":"URL workspaceid parameter 'message' is not a valid GUID.","code":400}
After running in Unity, when I look at my service page, I see a new instance created with a unity-sdk-example-workspace-deleteUpdated message. How did I cause this? Have I done something wrong that this appears new?
If you click the three dots in the image above next to conversation assistant you can click View API Details. You should be able to see your Workspace ID there.
You supply the version date to select the version of the service you want to use in your application. You will be using the last service release on or before the version date supplied. If you use today's date you will be using the latest release of the service.
The issue with the the call is there is no workspaceId supplied. Ideally there should be a null check for this param. I've created an issue for this: https://github.com/watson-developer-cloud/unity-sdk/issues/490
As for the unity-sdk-example-workspace-deleteUpdated it look like you ran the AssistantV1 example. The example runs through each operation in the service and attempts to invoke it. In this case it looks like it failed to delete the workspace or the example was stopped before it was deleted. It is safe to delete this workspace/skill.

CALL dbms.security.createUser('user','pass',false) does not work

I'm using the Neo4j desktop client for a proof of concept. I'm having trouble figuring out how to obtain credentials to call out to the Neo4j server to query from managed code. I'm using the driver, and I'm unsure how to actually obtain/manage credentials with Neo4j. All the places I've looked say that I should be able to run the following command in the terminal of the Browser for Neo4j...but doesn't work.
CALL dbms.security.createUser('username', 'password', false)
I get the following response when try to run that line.
I'm currently using version 3.3.1 for Neo4j, and it's being run as enterprise edition. Can anyone explain what is wrong? Am I missing some step to configure/unlock this API call to add a user?
It's a limitation of the Desktop version :
Anybody & everybody can get a free-for-development use (single-user,
local desktop/ single machine) license via Neo4j Desktop.
It's a single user database, so obviously you are not allow to create.

How to call "Action Result" ASP.NET MVC at specific time (Daily)

I have a system for sending E-mails to users by a specific time .
built in ASP.NET MVC4 and has an action result "function" for checking the time of messages and send it if the day of the message is today .
how can I call this action result (daily) -like a scheduler- in efficient way ?
Thanks.
Whilst a separate service / application would be better, you could use wget.
GNU Wget is a free software package for retrieving files using HTTP,
HTTPS and FTP, the most widely-used Internet protocols. It is a
non-interactive commandline tool, so it may easily be called from
scripts, cron jobs, terminals without X-Windows support, etc.
You would then do something like:
"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --no-check-certificate https://www.exammple.com/YouController/YourAction -O NUL
in a .bat file and set that to run via a windows Scheduled task at the time you require (assuming you don't need to run it less than every 60 seconds - if you do, let me know as I have another way around this using a windows service to call the bat file instead).
Omitting the -O NUL part would also save the output so you could see if everything ran successfully by doing:
public ActionResult YourAction()
{
//Do your code, get some stats that show it ran properly.
return Content("Return your stats here.");
}
from your controller action.
More efficient will be when you create new application as Windows Service. There u can easy set code to start at specific time. in this solution you will have more flexibility and independent. You can start hire : Windows Service to run a function at specified time
You could create a small console application that just calls the API do send out the emails. You can then schedule the console app to run at a specific time using the Windows Scheduler; you can even have it run without showing the console window. See here or here for details on how to schedule a task.
Use Azure Functions, that's exactly what it was built for. It's really good.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview

Azure Application Insights custom response metric

I need some help to find a good pattern for a custom application insights metric.
Environment
I have a custom Windows Service running on multiple Azure VMs.
I can successfull add Events to my Monitoring instance on Azure.
Goal
I want to create a custom metric that allows me to monitor if my windows services are running and responding per instance. It would be perfect if it acts like the respond timeout in website metric.
Each service instance has a custom maschine related identifier, like:
TelemetryClient telemetry = new TelemetryClient();
telemetry.Context.Device.Id = FingerPrint.Instance;
Now I wnat to create a alert if one of my Service instances (Context.Device.Id) is not running or responding.
Question
How to achive this?
Is it even possible or usefull to Monitor multiple instance of one service type onside on application insight? Or must I open one single application insight per instance?
Can anybody help me?
Response to Paul's answere
Track Metric Use TrackMetric to send metrics that are not attached to particular events. For example, you could monitor a queue length at regular intervals.
If I do so, whats happens if my server made a restart (update or somethink) and my service don't start up. Now the service did't send a TrackMetric to the application insight and no alert is raised because the value don't drop below 1, but the Service is still not running.
Regards Steffen
I found a good working solution, with only a few simple steps.
1) Implement a HttpListener instance on a service port (for example 8181) with a simple text response "200: OK"
2) Add a matching endpoint to the azure VM imstande
3) Create a default web test on "myVM.cloudapp.net:8181" with checkup of response text
Work great so far and matches all my needs! :)
Per the documentation on Azure portal:
https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/#track-metric
Track Metric
Use TrackMetric to send metrics that are not attached to particular events. For example, you could monitor a queue length at regular intervals.
Metrics are displayed as statistical charts in metric explorer, but unlike events, you can't search for individual occurrences in diagnostic search.
Metric values should be >= 0 to be correctly displayed.
c# code looks like this
private void Run() {
var appInsights = new TelemetryClient();
while (true) {
Thread.Sleep(60000);
appInsights.TrackMetric("Queue", queue.Length);
}
}
I don't think there is currently a good way to accomplish this. What you're actually looking for is a way to detect a "stale heartbeat." For example, if your service was sending up an event "Service Health is okay", you'd want an alert that you haven't received one of those events in a certain amount of time. There aren't any date/time conditional operators in AI's alert system.
Microsoft might explain that this scenario is not intended to be satisfied by AI, as this is more of a "health checking" system's responsibility, like SCOM or Operation Insights or something else entirely.
I agree this is something that needs a solution, and using AI for it would be wonderful (I've already attempted to accomplish the same thing with no luck); I just think "they" will say its not a scenario in the realm of responsibility for AI.

Calling website through Windows Service

Looking at creating a windows service that will run on an IIS Server. Said service will access an url (mysite.com/mailflow.ashx) every 5 minutes. This is done to get the mailflow going, which is done by accessing the mailflow.ashx file.
Is: https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx
what I'm looking for in my scenario or is there another class that will do the job?
Coming from a non-coding background but I want to do this on my own as a learning experience.
Small hints are more than enough.
Cheers!
Unless you really want to learn coding, I'd recommend simply creating a scheduled task in windows. Make it call the following js script (called wget in my case)
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
WScript.Echo(WinHttpReq.ResponseText);
and set the task to start the following program cscript with the following arguments /nologo C:\Path\To\wget.js http://my.url.com
There are plenty of ways to ping an remote url, so you may decide to use another option (perhaps simply launching then killing a browser) but coding a service really is overkill if this is the only task you need
Yes, the HttpWebRequest class is what you need.

Categories

Resources