Jump to content

David-

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by David-

  1. As of yesterday morning this issue appears to be resolved for both self hosted servers and pulseway direct customers.

    I was able to install Kaspersky on a customers computer!

    If you are getting the Agent Missing error you will need to uninstall kaspersky through Pulseway than reinstall it. Worked for me.

  2. I have a few questions.

    How long is the output retained for? Can I change that retention time if it is too short.

    Are there built in commands or settings to push these to the notification system? Primarily in the situation where error or warning appears in the output.

    Thank you for your time!

  3. +1

    Just as a heads up

    #turn off notifications
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor" -Name "MaintenanceMode" -Value "0"
    
    #Scripts here
    
    #turn on notifications
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor" -Name "MaintenanceMode" -Value "1"

    Does work. 

    Reference Paul's post (2nd post). Also the gentlemen who created the post had luck scheduling maintenance mode to turn back on a bit after the system turned back on.

    Spent 15 minutes digging the reference up. Hope it helps someone else too.

     

  4. I have been unable to get the vast majority of my powershell scripts to run. Scripts that run with no issues when run locally. Many that do not require admin access.

    I have tried running them without power shell user impersonation enabled.

    I have attempted creating and using an ID that is part of the administrator group.

    Enabling the administrator ID than using it as ps user impersonation.

    I've verified user impersonation settings in registry are correct.

    No errors are being registered in pulseway.

    I am testing on a system that does not have a domain. So I have left that field blank. Just in case I attempted to fill it with the system name a few times.

    My ultimate goal would be to use the administrator to run commands. I am willing to accept running as a user that is part of the admin group.

    An example of a script I am certain works, but now through pulseway.

    ## Enable Storage Sense
    ## Ensure the StorageSense key exists
    $key = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense"
    If (!(Test-Path "$key")) {
        New-Item -Path "$key" | Out-Null
    }
    If (!(Test-Path "$key\Parameters")) {
        New-Item -Path "$key\Parameters" | Out-Null
    }
    If (!(Test-Path "$key\Parameters\StoragePolicy")) {
        New-Item -Path "$key\Parameters\StoragePolicy" | Out-Null
    }
    
    ## Set Storage Sense settings
    ## Enable Storage Sense
    Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "01" -Type DWord -Value 1
    
    ## Set 'Run Storage Sense' to Every Week
    Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "2048" -Type DWord -Value 7
    
    ## Enable 'Delete temporary files that my apps aren't using'
    Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "04" -Type DWord -Value 1
    
    ## Set 'Delete files in my recycle bin if they have been there for over' to 14 days
    Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "08" -Type DWord -Value 1
    Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "256" -Type DWord -Value 30
    
    ## Set 'Delete files in my Downloads folder if they have been there for over' to 60 days
    #Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "32" -Type DWord -Value 1
    #Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "512" -Type DWord -Value 60
    
    ## Set value that Storage Sense has already notified the user
    Set-ItemProperty -Path "$key\Parameters\StoragePolicy" -Name "StoragePoliciesNotified" -Type DWord -Value 1

     

  5. Adding one line hides the ID from the user.

    $Username = "ID to create"
    $Password = "Password for created ID"
    
    $group = "Administrators"
    
    $adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
    $existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $Username }
    
    if ($existing -eq $null) {
    
        Write-Host "Creating new local user $Username."
        & NET USER $Username $Password /add /y /expires:never
        
        Write-Host "Adding local user $Username to $group."
        & NET LOCALGROUP $group $Username /add
        
    	New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" -Name $Username -PropertyType DWord -Value 0 -ea SilentlyContinue -wa SilentlyContinue
    
    }
    else {
        Write-Host "Setting password for existing local user $Username."
        $existing.SetPassword($Password)
    }
    
    Write-Host "Ensuring password for $Username never expires."
    & WMIC USERACCOUNT WHERE "Name='$Username'" SET PasswordExpires=FALSE
    
    exit 0;

    I have not used created ID to run scripts. Wanted to give back, if I didn't post this now I would never post it.

    I am new to scripting with pulseway. Does Write-Host go somewhere meaningful, or is this just also a script you manually run?

    Thanks for the ID creation with  error checking!

×
×
  • Create New...