Jump to content
DigitalDentist

Powershell Scripts Not working

Recommended Posts

Can someone tell me why this script works locally from the server but not from Pulseway. I've tested running the script both with impersonation enabled and disabled. Both tests were done on server 2012 R2. One with default Powershell version and one with 5.1. This script runs perfectly fine from the server itself just not through pulseway. I have several scripts that give the same type of error. I'd appreciate any help so I can figure this out. It seems like Pulseway doesn't like certain characters? 

ForEach ($COMPUTER in (Get-ADComputer -Filter '*' | Select -ExpandProperty Name)) 

 {
  $key = “SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install” 
        $keytype = [Microsoft.Win32.RegistryHive]::LocalMachine 
        $RemoteBase = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype,$Server) 
        $regKey = $RemoteBase.OpenSubKey($key) 
        $KeyValue = $regkey.GetValue(”LastSuccessTime”) 
     
        $System = (Get-Date -Format "yyyy-MM-dd hh:mm:ss")  
             
        if    ($KeyValue -lt $System) 
        { 
            Write-Host " " 
            Write-Host $computer "Last time updates were installed was: " $KeyValue 
        } 
    }

Screenshot_20170721-132009.png

Screenshot_20170721-132017.png

This is what it looks like when ran from the server without involving pulseway

20170721_132729.jpg

Share this post


Link to post
Share on other sites

Hi,

At first you will need to get the PS session and then you will be able to run this script via Pulseway:

Get-PSSession -ComputerName "computer name"

Share this post


Link to post
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

  • Similar Content

    • By itshero
      Hello,
      I figured I would re-post this issue we have been having.   Only to solve one issue this time.  I have successfully uninstalled the pulseway application from a user's computer that was having major issues.  (Deleted all pulseway services, related folders, and registry entries).  However we are unable to install the program again.  The user is using Windows 7 64 bit.  Please assist, as I don't want the users PC to be not monitored.  
    • By DigitalDentist
      I have Pulseway configured on 60 servers all at different locations. I'm waiting to deploy to the workstations until I get it configured just right. My question is: is there a way to get a list of installed programs across all devices? Say I need to know what version of chrome is installed on all the devices, to gauge which ones need updated etc -how would I go about doing that if it's possible?
    • By itshero
      Hello,
      I was having an issue install the Kaspersky Anti-Virus on a machine, and decided to try uninstalling Pulseway from the system.  I uninstalled the program, and deleted the service using the sc delete "PC Monitor" command under an administrator account.  The issue I am having, is the re-installation fails, and hangs on the "scheduled tasks" portion of the initialization wizard (the part before the pc monitor panel comes up).  After the installer crashes, it still shows the application as "installed" for the user, and most things work on the machine. (remote desktop does not from the pulseway dashboard).  The installation also does not show up in programs and features.  
      OS is Windows 7 64 bit, and user is on a domain, and has local administrator.  
      Is there anything I can do other than reformatting the user PC to get a genuine clean install so I can use the product we are paying for?
       
      Thanks.
    • By itshero
      We are having issues installing the anti virus on a few clients with Symantec already installed.  Please assist.
    • By DigitalDentist
      It would be nice if instead of only by date or severity we could sort notifications by type. All low disk space alerts, all server offline etc.
×