How to display a pop up message in a remote computer using powershell

In my daily work, there are times which I need to contact a user who is using a particular PC, but they don’t respond. Mostly, I need to contact them to inform about something, or get them to reboot, or install something etc. There are some cases which it is not possible, such as :

  • They use a generic account which is shared, so we can’t find who exactly is using that PC
  • They are logged off from IM
  • They don’t respond to IM or just ignore them.

In these kind of cases, it is easier if we have some way to forcefully push a message to the PC. I found an easy solution from internet that can do this in every computer that you have admin access.

Open a text editor and add the following in it, then save it with .ps1 extension.

Function remote_message{

$server = read-host -prompt ‘Input PC name’;
$message = read-host -prompt ‘Enter the message’;

Invoke-WmiMethod -Class win32_process -ComputerName $server -Name create -ArgumentList¬† “c:\windows\system32\msg.exe * $message” }

remote_message

To run this, open powershell, then navigate to the saved location and run. And follow the input prompt.

remote_message

No matter who is logged in the remote PC, they will get the message pop up on top of all their windows.

remote_message_2

 

How to remove UAC prompt for a software in Windows

[This was originally published in my another blog on July 2016.]
Today I received a support request from a user who is facing issues while running a macro script. He was facing Run-time error 429 : ActiveX Component cannot create object.

Though I have never written macro, I decided to give a try. When clicked the debug button I got the following message.

OK. Data navigator is an internal software that we use for pulling some data. This message showed that this error has something to do with the Data Navigator. Its installed properly and is working fine when opening. However when compared to another PC which has no issue in running the script, found a small difference, there is a UAC Prompt in this PC when opening the software.
I am not sure why in some PCs it has this prompt while others not. Anyway I decided to find a way to remove this prompt and try again.

A quick google search brought me here.

Following the instructions, I downloaded and installed Microsoft application Compatibility toolkit. Once done, you will see 32 and 64 bit versions.

Take note that even if you have a 64 bit OS, the 64 bit version can only be used for 64 bit software. For my case, I have a 64 bit OS, but the data navigator is a 32 bit software.

Once opened the software, click on the Fix button.

Enter the necessary information.
Click Next and select the RunAsInvoker checkbox.
Click the Test Run button to make sure that there is no prompt when opening the mentioned software.

Click Next and make sure that the RunAsInvoker is checked there also.

Click Next, followed by Auto Generate from the next screen.
Click Finish

Now, we need to save the database. For that, click the Save button, and give the database a name.
Provide the save location when prompted.

Click on File, and then Install the database.
Now, click OK and close the Compatibility Administrator. Go to the Start menu and right-click your application, select properties and select the Advanced button. Make sure that  Run as administrator checkbox is cleared. Click OK.
Now click the Compatibility tab, then Change settings for all users and tick the Run this program as an administrator checkbox.
VOILA !! We are done.

This made the macro to run properly, and made my user really happy. I hope this helps you all too.