Jump to content

PowerOfTheShell Plugin 1.5


Cptrico
 Share

Recommended Posts

This looks like a great tool, but I am having a few problems running it.  I have installed the plugin on one of the servers I support.  I can see the plugin on my mobile and can run the scripts, but I don't get anything displayed after running.

 

I have pasted the trace.log details below - hope someone can help... Thanks:

 

 

4/19/2013, 21:27:50.392: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:27:56.444: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:02.513: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:14.572: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:20.640: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:24.665: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:30.702: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:34.727: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:28:50.171: [service] System.NullReferenceException: Object reference not set to an instance of an object.
   at PowerOfTheShell.Program.GetPageDetails(Int32 pageId)
   at .(Object )
4/19/2013, 21:29:16.738: [service] Received Request Plugin page command 'PowerOfTheShell.Program[>x1x2x3x4x5<]905[>x1x2x3x4x5<]905' from device Id: '49c135463987e233'
4/19/2013, 21:29:16.753: [service] System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=**************' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=****************
   at PowerOfTheShell.Program.PageCommandReceived(Int32 pageId, Int32 commandId)
   at .(Object )
 
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

 

 

Link to comment
Share on other sites

  • 1 month later...

Hi all,

 

I am going to work on PowerOfTheShell plugin again, hope work will not come between me and the fun of writing this :)

 

I have some ideas for this plugin I want to test and share with the rest of you, so stay tuned in the near future.(no spoilers) 

 

But also I want to ask you if you have any thing that you think is missing or should be improved.

 

Looking forward for your input. :)

 

Cheers.

Link to comment
Share on other sites

  • Administrators

The ability of changing (add, edit or remove) configured scripts on the fly using the mobile app or web app would be awesome. I can download the scripts using command line from mobile app and then using your plugin it would be awesome to be able to map the new scripts and use them without having to leave the mobile app :lol: .

 

Should be fun to code.

Link to comment
Share on other sites

Hi Paul,

 

It's a great idea, I want to try and make the task of adding scripts and sorting them a lot easier than it is.

This if defiantly something I will be working on improving. :)

Link to comment
Share on other sites

  • 2 months later...

I can't for the life of me get the plugin to work.  I've read over the forum posts and have tried everything I can think of, hopefully you're able to see whatever I've missed.  So I'm getting the 'Problem detected in the parser, please check the XML file' error.  I have the diagnostics running but that's all the trace.log file says too, no additional information.
 
Here's exactly what I've done...  I unzipped the package to a subdirectory of my PCM folder I named MYPLUGINS.  I loaded the PSV2 dll as a plugin from the Latest Build folder which trace.log says successful.  I copied the scripts folder from the script pack to the PCM folder, and the config.xml file to the PSV2 folder (where the dll is).  I verified the xml path to be correctly pointing to the scripts folder, and even removed all but one subpage category as a test.  I get the error no matter what.
 
I'm running Win7 x64, and everything is up to date.  Any help would be appreciated.  Below is the contents of my config.xml file for reference:
 

<?xml version="1.0"?>
<!-- Example Xml -->
<main> 
  <group title="PoweroftheShell" enabled="True" maxResults="50">
 
<page title="PowerShell" pageId="1" subtitle="All the tools!" enabled="True">
 
   <subpage title="Hardware" pageId="5" subtitle="Show Hardware Details" enabled="True" />
<subpage parent="5" title="BIOS" pageId="501" subtitle="Details from BIOS" enabled="True">
        <command title="Run Script" commandId="501" path="C:\Program Files\PC Monitor\scripts\bios.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="Computer" pageId="502" subtitle="Make, Model, Serial" enabled="True">
        <command title="Run Script" commandId="502" path="C:\Program Files\PC Monitor\scripts\compinfo.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="Video Card" pageId="503" subtitle="Video Card Details" enabled="True">
        <command title="Run Script" commandId="503" path="C:\Program Files\PC Monitor\scripts\video.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="CPU" pageId="504" subtitle="CPU Details" enabled="True">
        <command title="Run Script" commandId="504" path="C:\Program Files\PC Monitor\scripts\cpu.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="Network Card" pageId="505" subtitle="Network Card Details" enabled="True">
        <command title="Run Script" commandId="505" path="C:\Program Files\PC Monitor\scripts\nic.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="Memory" pageId="506" subtitle="Memory Details" enabled="True">
        <command title="Run Script" commandId="506" path="C:\Program Files\PC Monitor\scripts\memory.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="Dell Warranty Info" pageId="507" subtitle="Show expiry date etc" enabled="True">
        <command title="Run Script" commandId="507" path="C:\Program Files\PC Monitor\scripts\dell_warranty.ps1" arguments="" /> 
</subpage>
<subpage parent="5" title="Hard Disk Info" pageId="508" subtitle="Show Disk Info" enabled="True">
        <command title="Run Script" commandId="508" path="C:\Program Files\PC Monitor\scripts\disk_info.ps1" arguments="" /> 
</subpage>
 
</page>
   </group>
</main>
Link to comment
Share on other sites

Hi There,

 

Hope I can help you out. I have tested your XML and it Works fine so that is not the problem.

 

I would rather think it's a problem with rights. You mentione you copy the files to a subfolder of PCM.

 

I tried the same and that also worked. I placed the three files here.C:\Program Files\PC Monitor\Plugins\POTS

 

PCMonitorClient.dll

PowerOfTheShell.dll

config.XML

 

added the plugin using PowerOfTheShell.dll and it worked. Have you changed the user that PCM runs as ? it should by default have access to read into that folder. Also you must be sure the file is called config.xml otherwise it will not be loaded.

 

Hope it helps.

 

Link to comment
Share on other sites

Hi There,

 

Hope I can help you out. I have tested your XML and it Works fine so that is not the problem.

 

I would rather think it's a problem with rights. You mentione you copy the files to a subfolder of PCM.

 

I tried the same and that also worked. I placed the three files here.C:\Program Files\PC Monitor\Plugins\POTS

 

PCMonitorClient.dll

PowerOfTheShell.dll

config.XML

 

added the plugin using PowerOfTheShell.dll and it worked. Have you changed the user that PCM runs as ? it should by default have access to read into that folder. Also you must be sure the file is called config.xml otherwise it will not be loaded.

 

Hope it helps.

 

 

So oddly enough I woke up this morning and it was working...I haven't changed a thing.  My server reboots every night at 2AM, so perhaps that's all it needed...  Thanks for your time in responding.

Link to comment
Share on other sites

  • 9 months later...

Hey, Thanks for the addon.. I use it daily. I am trying to use one virtual computer as my main management box. So, my thoughts would be that I would create scripts to manage SCCM, VMM, SCOM, etc. Seems that even though I have my credentials entered, I am getting a access denied when running certain scripts that need to access remote systems. Any thoughts on why it isn't working or how to troubleshoot the issue?

Link to comment
Share on other sites

Hi BadCoder.

I am glad that you find the plugin useful.

A couple of things I think of. I guess you use the elevate setting and have your domain credentials in there? Or do you add username / password in the script it self ?

Also does the script work as it is outside of PCM and POTS.

/cptrico

Link to comment
Share on other sites

  • 4 months later...

Hello Cptrico,

 

I am using your plugin for a while now, and it is very useful! I am trying to compare it with display changer . I have successfully created the .ps1's that are required, but when I try to run the command from my Pulseway Android app, the app reports "there is no monitor with that name.". I think that is happening because of the variables "\\.\DISPLAY1". Can you help me solve this? What should I do?

 

This is an example .ps1:

& "I:\12noon Display Changer\dc64cmd.exe" -monitor="\\.\DISPLAY1" -width=1366 -height=768
& "I:\12noon Display Changer\dc64cmd.exe" -monitor="\\.\DISPLAY2" -detach
Link to comment
Share on other sites

Hi KreAch3R

Glad you find the plugin useful. :)

I am not familiar with 12 noon and the parameters but I will try it out for size and let you know my findings. One thing maybe. The script runs fine when you execute it from your own user in powershell right ? Have you looked if you have set the right impersonation settings in POTS maybe.

/cptrico

Link to comment
Share on other sites

Hi KreAch3R

Glad you find the plugin useful. :)

I am not familiar with 12 noon and the parameters but I will try it out for size and let you know my findings. One thing maybe. The script runs fine when you execute it from your own user in powershell right ? Have you looked if you have set the right impersonation settings in POTS maybe.

/cptrico

 

Yes, it does when running it in powershell! I thought that it had something to do with user permissions, but I don't know what I should fill in the user and password fields. I am using an outlook online account as my Windows User account. This account also has 2-step verification enabled. I tried some setups (using/emitting @outlook.com, trying my main password) but it doesn't seem to work. Should I create an app-specific password?

Link to comment
Share on other sites

Yes, it does when running it in powershell! I thought that it had something to do with user permissions, but I don't know what I should fill in the user and password fields. I am using an outlook online account as my Windows User account. This account also has 2-step verification enabled. I tried some setups (using/emitting @outlook.com, trying my main password) but it doesn't seem to work. Should I create an app-specific password?

Hi Again, that is actually not something I have come across before using this kind of user. I would just expect if the user were capable of executing the PowerShell script it would be fine to impersonate as this user in POTS. You could try just to test the script and create a local user, try it out first in PowerShell and then add it to POTS if it works after we know it is user related and there is a need for a workaround or requirement for a dedicated user for impersonation.

 

 

Cheers

/Cptrico

Link to comment
Share on other sites

Hi Again, that is actually not something I have come across before using this kind of user. I would just expect if the user were capable of executing the PowerShell script it would be fine to impersonate as this user in POTS. You could try just to test the script and create a local user, try it out first in PowerShell and then add it to POTS if it works after we know it is user related and there is a need for a workaround or requirement for a dedicated user for impersonation.

 

 

Cheers

/Cptrico

 

I created a local "Test" user, run the powershell script while logged in from that user, and it run fine. I tried to run it from POTS while impersonating "Test" and it didn't run. I didn't have to use the impersonation option before though, and I don't know if I am doing everything correctly. How exactly is POTS calling the powershell script? Given that the script responds with "no monitor found with that name", what exactly is missing and the script can't complete completely? 

Link to comment
Share on other sites

  • 1 month later...

I tried to use "power of the shell" to start a powershell script and recognized that pulseway uses the current version of powershell on the machine. The scripts I am using are using powershell 2. Usually I am using the "-version 2" when I execute them. How can I tell pulseway to start the scripts with this argument ?


Best regards,
Jendrik

Link to comment
Share on other sites

Hi Jendrik,

 

Thanks for trying the plugin, as Digbyp mentiones it dosn't require nor is it possible to specify which version to run with. By default it depends on which version of powershell you have version 2 is backwards compatible with 1 and version 3 is compatible with both 2 & 1. So as long as you have either version 2 or 3 it shoudln't be an issue.

 

Cheers

 

/cptrico

Link to comment
Share on other sites

  • Staff

Hi everyone,

 

I've raised a question about this with our development team and they believe that it makes sense that it doesn't work because:

 

Explanation: On Windows Vista (or higher) operating systems, Microsoft moved all windows services into a different User Session on the computer, namely Session 0. This change was done to enhance the security (and privacy) of the user so that Windows Services will no longer be able to interact with the User Sessions, behaviour called "Session 0 Isolation". Furthermore services run in separate WindowStations (console session runs in WinSta0 and session 0 into a generated WindowStation for each windows service). This is the reason why the Terminal or PowerShell features from Pulseway cannot launch applications directly into the Console Session. Since POTS is running in a sandbox in the Pulseway Service it has the same limitations as windows services do.

 

Solution: You could create a Scheduled Task (impersonate it run with your user credentials) and have it run the powershell script you desire. User impersonated scheduled tasks run into the console session and CAN interact with the Desktop the user currently sees. You can use Pulseway to start the scheduled task on demand.

 

Regards,

Chris

Pulseway Support

Link to comment
Share on other sites

  • 6 months later...
  • 2 weeks later...

Hi Cptrico.

 

Thanks for your cool plugin.

 

 

It seems, that I have a Special Problem.

 

 

I try to run a script, which trys to add a snapin via Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 command.

 

When I open a powershell on a gui at the Server, the script does what it intended to do.

 

 

When I try to do the same within POTS I receive a message "Get-Mailbox ..." is no part of a cmdlet, a function ....

 

 

When I try to add the same snapin within a 32 bit powershell, the command to add the snapin says, that this snapin isn't registered.

 

 

It seems to be that your plugin runs the 32 bit powershell, right? This snapin is only available within 64 bit powershell.

 

 

 

 

 

My System:

Windows Server 2008 R2, newest updates installed (incl. WinRM 4 for Powershell 4)

Pulseway 4.7.6 Agent.

Impersination within your plugin is activated to our Domain account.

 

The script loads the following things at the beginning:

Import-Module ActiveDirectory
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

 

 

What I am trying to do, is to generate statistics from Exchange 2010 Mailboxes.

 

 

As I said: The script itself works.

 

 

Any advise?

Edited by mario_saternus
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...