HL2 sleep settings - hololens

I am building a tool for HL2.
I am using the command below to set the sleep settings in HL2 through my tool.
"https://127.0.0.1:10443/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC=1800&ValueDC=1800";
After running the above command, in the device portal, I can see that both on battery and plugged in values are set to 30 min, as expected.
Though my device goes to sleep after few min, maybe 3 or 5 minutes.
If I set the settings manually through the device portal, then everything works as expected, the device goes to sleep after 30 min.
Is there sth in the command that I am using wrong?
In HL1 it seems like it is working, but not in HL2.
Any advice?

The web interface uses the same REST APIs. I would recommend enabling the Developer Tools in your browser (e.g., F12) and looking at the network requests when changing the value in the web page. There are multiple requests that happen when changing the sleep settings. Your automated call should follow that pattern.

When changing the sleep settings, the Device Portal makes these POST requests:
.../api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC=180&ValueDC=600
.../api/power/cfg/SCHEME_CURRENT/SUB_VIDEO/VIDEOIDLE?ValueAC=180&ValueDC=600
.../api/power/activecfg?scheme=SCHEME_CURRENT
You should make the same requests in your tool. Just replace the values (180 and 600) with your own.

Related

How to live track of progress in terminal over portal?

So, I have this question that I didnt try to make beforeand was not sure how to search and what to do.
To give little background : Currently me and couple of my friend trying to building drone hacking platform which have rasperry pi on it. Our plan is to established wifi connection with base station and have a portal running on pi that will trigger some scripts including wpa bruteforcing. But for brute force the captured handshake will forward to base station and bruteforcing process will start on that machine.
My question is we need to be able to live track of the bruteforcing process over the local built portal so when we go to that portal we can see the percentage of progress and etc.
However, I didnt do such a think like this before and have no idea and/or dont know that and how to research for that. Therefore if anyone can give a lead or some idea I would appriciate it.
Thank you,
Write to a file and then track each change using tail -f <filename>. You can do this remotely over ssh

Unexpected Disconnection with Code 1006 on Windows Server Hosted on Azure

My application does client authorization over WebSocket connection using ws#7 but after several minutes suddenly it gets disconnected with the error code 1006.
Interesting thing is it's working on AWS Windows Server instances but not on Azure instances or VMWare VMs. I assume there is some kind of configuration related to WebSockets should be handled before installing Node-based application but the main question is what I have to configure in order to move forward.
1006 error usually happens when there is a timeout. In the library you are using, the ws timeout is 30 seconds: https://github.com/websockets/ws/blob/4f293a8726092c75539287dd07358afaf151a2e5/lib/websocket.js
Check whether you are using a gateway or something in between the VM with a timeout less or equal than the ping interval that ws automatically does from the client.
You can usually can see this automatically generated ping messages in Firefox with the F12 tools in the network tab, these do not show up in Chrome nor in Edge but they happen as well:
I had similar problem with my Windows machine tryng to connect a server using Visual Studio Code. I have reset the routes, and reboot the machine, that solve the issue.
To reset use:
route -f

Interactive website for linux server

creation of a website through which can access Linux server and where can execute some operations like executing scripts, firing up some commands. need some expert guidance with some concepts.just guide me how can i achieve through, i have goggled a lot unable to get the proper concepts or methods. or is it even possible.
Have you considered using something along the lines of VNC or SSH? As JNevill pointed out, either of these methods would be infinitely more secure. Also, consider using something like cron for scheduled jobs.
However, sometimes a webpage for running a program on a server may be acceptable. e.g. IoT project. To do this, you would setup an API page using a back-end language like PHP (recommended if you're using Linux). In the back-end language you would check your user credentials, and then run the command.
Some guidelines in doing this:
Never allow commands to be entered on the webpage, only allow tasks to be completed using controlled inputs like buttons, selectboxes and sliders. i.e. a button to get an Arduino to close your garage door, or a slider to dim/brighten a light bulb, or a button to start a program to index something, etc.
None of these "command buttons" should ever do anything harmful. i.e. delete a folder or file.

Enforcing PIN on Windows Store Apps (8.1)

We want to enforce at minimum a PIN and an inactivity timeout on our Windows Store App.
The Exchange Active Sync (EAS) policy API looks like the right thing to use but it should be used with much caution.
You can either check for compliance or enforce compliance
MaxInactivityTimeLockValue should work for the minimum time before the screen locks
The trouble is that the check RequestedPolicy.CheckCompliance() never succeeds. I have tried it on a Surface 2 RT that has lock screen set to 2 mins and a Windows 8.1 Desktop that had a screen saver set to display after 1 minute and show password on resume.
Both of these fail the following check
RequestedPolicy.MaxInactivityTimeLock = TimeSpan.FromSeconds(300);
ComplianceResult = RequestedPolicy.CheckCompliance();
I would expect ComplianceResult.Compliant to be True but it never is. Has anyone ever managed to get this work as expected?
EDIT
Once set i cannot see any way of undoing this on my Surface RT.
I have found a way that the user can do it in this article, Reset EAS Policies However I still cannot see a way of unenforcing in code.
Thanks
As far as I can tell you can only check for compliance of a Policy if one has already been set. If no policy has been set, even if you would be compliant with it, CheckCompliance will return false.
There is no way of Enforcing PIN there is only a way of disabling what Microsoft calls "convenience logons", these are:
Picture password
PIN
Seeing as any user would have needed to already have a user name and password to get the account on the Windows 8.1 device there will always be at least a username\password combo

ASP.Net Restart IIS

Long story short -- we have 2 webservers that run a 3rd party asp.net application. Randomly (so far) they just...stop working. I have an outside check that will tell me when it stops working within a minute or so. Right now I have to get onto the machines through RDP and issue an iisreset. Which is fine until I'm not at a machine and I have to get to one PDQ.
I wrote a simple page that will issue an iisreset on the offending remote machine(s). This works, usually. Sometimes "iisrestart \machinename" will stop the IIS service, but not restart it, which is bad.
Ideally, I'd like to know if I can just stop the service, try to start it, and if it doesn't start in 10 seconds, try to start it again. But I don't know how to monitor the status of a service remotely.
Can someone point me in the right direction?
This is the right direction: VBScript and WMI to stop, monitor, start the service on the remote machine.

Resources