Initiate a Windows Service with Administrative Privileges utilizing the Windows Push Notification Service

Kenny Roy E 45 Reputation points
2023-12-11T08:43:28.34+00:00

Greetings, developers!

I need to gather hardware, network, and software information, modify the registry, and execute PowerShell commands using a Windows service. This service should be triggered upon receiving a push notification from the Windows Push Notification Service.

I have developed a Universal Windows Platform (UWP) application that integrates with Azure's notification service. Additionally, I've incorporated a background task that activates upon receiving a raw push notification.
I'm facing a roadblock in progressing because the background tasks lack administrator privileges to execute my tasks. I attempted to create a Windows Service to perform these tasks but am currently stuck in the process of packaging, installing, and initiating the service from the UWP application and background task.

I would greatly appreciate your assistance or guidance in resolving this matter. If you have any insights or suggestions, please feel free to share them. Thank you in advance for your help!

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
323 questions
Universal Windows Platform (UWP)
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,646 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,570 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 18,391 Reputation points Microsoft Vendor
    2023-12-12T08:09:40.4866667+00:00

    Hi @Kenny Roy E ,

    Welcome to Microsoft Q&A!

    According to your scenario, it is recommended that you use Desktop Bridge in UWP to start a win32 desktop application and let this desktop app (such as WPF) to gather hardware, network, and software information, modify the registry, and execute PowerShell commands in background.

    It will package your UWP and WPF app together, and realize communication between UWP and WPF through Appservice. For more details, you can search Stefan Wick's blog “UWP with Desktop Extension” in your browser.

    Thank you.

    Junjie


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.