Search the Community
Showing results for 'how to powershell'.
Found 436 results
-
Powershell use variables
Hello, Good morning, I have a Powershell script which should install a certain software at our customer. During the installation a key is needed. I would like to enter this key every time I run the script, is this possible? Background is that we have different keys for each customer, so I do not have to create 10 versions of the script with different keys.
-
How to start an application via a script using powershell
I'm trying to start an application that will start via PS script. I create pulseway script using Windows Powershell to run this command but I can't get the application to start. $env:Path += "C:\Program Files (x86)\NetDocuments\ndOffice\ndOffice.exe" & "C:\Program Files (x86)\NetDocuments\ndOffice\ndOffice.exe" However if I go to the remote computer, open Windows Powershell and run these commands the application opens as desired. All my other scripts I have work on this computer, so I'm executing it correctly. Please advise. Greg
-
Uninstalling Windows Built-In Apps via PowerShell
Hello, I am trying to uninstall Windows Apps (Cortana, Weather, Mail, etc.) from my computers on Pulseway. I made the following script, that works perfectly when ran locally, but when I try to run it through Automation with Pulseway, I get no success. dism /online /get-provisionedappxpackages |ft PackageName dism /online /remove-Provisionedappxpackage /packagename:Microsoft.DesktopAppInstaller_2019.125.2243.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.Getstarted_8.2.22942.0_neutral_~_8wekyb3d8bbwe #dism /online /remove-Provisionedappxpackage /packagename:Microsoft.Messaging_2019.125.32.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.MicrosoftOfficeHub_18.1903.1152.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.MicrosoftSolitaireCollection_4.4.8204.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.MixedReality.Portal_2000.19081.1301.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.Office.OneNote_16001.12026.20112.0_neutral_~_8wekyb3d8bbwe #dism /online /remove-Provisionedappxpackage /packagename:Microsoft.OneConnect_5.1902.361.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.People_2019.305.632.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.SkypeApp_14.53.77.0_neutral_~_kzf8qxf38zg5c dism /online /remove-Provisionedappxpackage /packagename:microsoft.windowscommunicationsapps_16005.11629.20316.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.WindowsFeedbackHub_2019.1111.2029.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.Xbox.TCUI_1.23.28002.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.XboxApp_48.49.31001.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.XboxGameOverlay_1.46.11001.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.XboxGamingOverlay_2.34.28001.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.XboxIdentityProvider_12.50.6001.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.XboxSpeechToTextOverlay_1.17.29001.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.YourPhone_2019.430.2026.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.ZuneMusic_2019.19071.19011.0_neutral_~_8wekyb3d8bbwe dism /online /remove-Provisionedappxpackage /packagename:Microsoft.ZuneVideo_2019.19071.19011.0_neutral_~_8wekyb3d8bbwe Get-AppxPackage |Select-Object -Property Name Get-AppxPackage *3d* | Remove-AppxPackage Get-AppxPackage *DesktopAppInstaller* | Remove-AppxPackage Get-AppxPackage *Getstarted* | Remove-AppxPackage Get-AppxPackage *Messaging* | Remove-AppxPackage Get-AppxPackage *MicrosoftOfficeHub* | Remove-AppxPackage Get-AppxPackage *MixedReality* | Remove-AppxPackage Get-AppxPackage *MicrosoftSolitaireCollection* | Remove-AppxPackage Get-AppxPackage *Office.OneNote* | Remove-AppxPackage Get-AppxPackage *OneConnect* | Remove-AppxPackage Get-AppxPackage Microsoft.People | Remove-AppxPackage Get-AppxPackage *skypeapp* | Remove-AppxPackage Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage Get-AppxPackage *WindowsFeedbackHub* | Remove-AppxPackage Get-AppxPackage *XboxApp* | Remove-AppxPackage Get-AppxPackage *Xbox.TCUI* | Remove-AppxPackage #Get-AppxPackage *XboxGameCallableUI* | Remove-AppxPackage Get-AppxPackage *XboxGameOverlay* | Remove-AppxPackage Get-AppxPackage *XboxGamingOverlay* | Remove-AppxPackage Get-AppxPackage *XboxIdentityProvider* | Remove-AppxPackage Get-AppxPackage *xboxSpeechToTextOverlay* | Remove-AppxPackage Get-AppxPackage *YourPhone* | Remove-AppxPackage Get-AppxPackage *zunemusic* | Remove-AppxPackage Get-AppxPackage *zunevideo* | Remove-AppxPackage I've tried different switches like -AllUsers, but I think the problem exists since Pulseway runs Powershell commands as nt authority\system Please let me know if there's something I can do to automate this with Pulseway.
-
Problem with default script 'Check System Drive Fragmentation'
I looked at this script, and it will always return "Operating system is not supported" because in the script $major and $minor are strings, I was able to confirm that with the commands: $major.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object $minor.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object I recommend updating the script to this, and I highlighted the changes: $version = (Get-WmiObject Win32_OperatingSystem).Version [int]$major = $version.split(".")[0] [int]$minor = $version.split(".")[1] if ($major -gt 6 -or ($major -eq 6 -and $minor -gt 1)) { Optimize-Volume -driveletter $pwd.drive.name -Analyze -verbos } Else { Write-Output "Operating system is not supported." } Here is the original script: $version = (Get-WmiObject Win32_OperatingSystem).Version $major = $version.split(".")[0] $minor = $version.split(".")[1] if ($major -gt 6 -or ($major -eq 6 -and $minor -gt 1)) { Optimize-Volume $pwd.drive.name -Analyze -verbos } Else { Write-Output "Operating system is not supported." } REF: https://learn.microsoft.com/en-us/powershell/module/storage/optimize-volume?view=windowsserver2022-ps REF: https://lazyadmin.nl/powershell/if-else-statements/ REF: https://theitbros.com/powershell-convert-string-to-int/
-
Install Dropbox with PowerShell
I made a install script for Dropbox to do a Silent install. UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists Improvements are welcome! Change the version if needed in the Source URL: https://www.dropbox.com/downloading?full=1&os=win # Silent Install Dropbox # Download URL: https://www.dropbox.com/downloading?full=1&os=win # Path for the workdir $workdir = "c:\ictwebsolution\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "https://www.dropbox.com/download?full=1&plat=win" $destination = "$workdir\dropbox.exe" Invoke-WebRequest $source -OutFile $destination # Start the installation Start-Process -FilePath "$workdir\dropbox.exe" -ArgumentList "/S" # Wait XX Seconds for the installation to finish Start-Sleep -s 60 # Remove the installer rm -Force $workdir\dropbox* For Windows 7 please change $source = "https://www.dropbox.com/download?full=1&plat=win" $destination = "$workdir\dropbox.exe" Invoke-WebRequest $source -OutFile $destination To $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile("https://www.dropbox.com/download?full=1&plat=win","$workdir\dropbox.exe") Since Powershell in Windows 7 does not support the Invoke-WebRequest Please let the user Log Off and On again after the installation of dropbox, then Dropbox wil auto start.
-
Powershell require new password
I have a Windows 10 Pro (local) machine that is not responding to: wmic UserAccount set PasswordExpires=True I've been digging a big hole looking for a comparable powershell command. Anyone know? Also, how to check if the user cannot change password is set. It does not list using net accounts
-
A How to Guide on Managing Bitlocker Encryption with Pulseway
A number of folks have requested the ability to manage bitlocker with Pulseway, so I thought I would share how I am doing this with Powershell scripts and Pulseway's custom fields feature. First, you will need to create a custom fields in Pulseway (Automation Tab --> Custom Fields). This fields should be a text variable that has the system context. I personally have 3, BitlockerKey, Protection Status (On/Off), and BitLockerVolumeStatus. BitlockerKey is probably the one most people will care about. . After Configuring the Custom fields, you will then need to create your PowerShell script. Notice you have inputs and outputs. You will want to click New for output. Name it what you wish, ensure it is a text variable type, and then turn on "set Custom Field Value" Now we toggle the flag for it being a windows powershell script. You should see in the top that it has created a comment #outputs with your defined output variable assigned the default value you gave it. Now we have our script: Update as of 4/18/2021, script now tracks 3 custom fields and will account for if a drive is encrypted but protection is off and no protectors have been added yet. # Outputs $ProtectionStatus = "na" $recoveryKey = "na" $VolumeStatus = "na" #region functions function Start-BitlockerEnable { Enable-BitLocker -MountPoint c: -EncryptionMethod XtsAes128 -UsedSpaceOnly -TpmProtector $today = Get-Date $scheduledtime = $today.Date.AddHours(23) [int]$SecondsToMidnight = ($scheduledtime - $today).TotalSeconds shutdown /r /t $SecondsToMidnight msg.exe * "Bitlocker Encryption has been enabled. A reboot is needed before the encryption will apply and has been scheduled for $scheduledtime local time. You can reboot before this if you prefer." #start-sleep 90 #msg.exe * "This Computer will reboot in 30 seconds to bitlocker Encryption" #start-sleep 30 #Restart-computer -force } #endregion functions #region execution $BitLockerStatus = Get-BitLockerVolume -MountPoint c: if ((Get-Tpm).tpmpresent -eq $true) { #If Volume is in the process of encrypting or decrypting the Volume status will not say fully. Don't make changes when it changes if (($BitLockerStatus.ProtectionStatus -match 'off') -and ($bitlockerstatus.VolumeStatus -notmatch 'progress')) { #NoBitlocker is enabled so run it. if ($BitLockerStatus.VolumeStatus -eq 'FullyDecrypted') { $recoverykey = $BitLockerStatus.KeyProtector | Select-Object -ExpandProperty recoverypassword if(!($recoveryKey)){ Add-BitLockerKeyProtector -MountPoint c: -RecoveryPasswordProtector } $newStatus = Get-BitLockerVolume -MountPoint c: $recoverykey = $newStatus.KeyProtector | Select-Object -ExpandProperty recoverypassword Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable recoverykey ""$recoverykey""") -Wait if ($newStatus.KeyProtector -match 'Recovery') { Start-BitlockerEnable } } #Bitlocker must be Partially enabled where drive is fully encrypted, but protection is off and no protectors exist. #Typically this is using xtsAES128 so you may wish to disable-bitlocker, then re-enable it with your protectors and prefered encryption level. else{ Disable-BitLocker -MountPoint 'c:' $decryptInProgress = $true While($decryptInProgress -eq $true){ $decryptstatus = Get-BitLockerVolume -MountPoint 'c:' if($decryptstatus.VolumeStatus -match 'progress'){ Start-Sleep 2 } else{ $decryptInProgress = $false } } Add-BitLockerKeyProtector -MountPoint c: -RecoveryPasswordProtector $newStatus = Get-BitLockerVolume -MountPoint c: $recoverykey = $newStatus.KeyProtector | Select-Object -ExpandProperty recoverypassword Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable recoverykey ""$recoverykey""") -Wait if ($newStatus.KeyProtector -match 'Recovery') { Start-BitlockerEnable } } } #BitLocker should already be enabled so log keys, volume status etc. else { $recoverykey = $BitLockerStatus.KeyProtector | Select-Object -ExpandProperty recoverypassword $ProtectionStatus = $BitLockerStatus.ProtectionStatus $VolumeStatus = $BitLockerStatus.VolumeStatus Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable recoverykey ""$recoverykey""") -Wait Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable ProtectionStatus ""$ProtectionStatus""") -Wait Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable VolumeStatus ""$VolumeStatus""") -Wait } } else { $recoverykey = 'NoTpm' Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable recoveryKey ""$recoveryKey""") -Wait } #endregion execution You can modify the above script as you wish. I personally have gone with a bit of a cautious approach where it will not skip the hardware check which will reboot the pc, but for me I prefer this approach to having it encrypt the drive without checking tpm is all good which could then result in the drive being encrypted and locking out the end user. At the end of all this, you now should be able to Both Enable bitlocker encryption as well as pull your recovery keys from pulseway like so :
-
Live powershell/cmd/bash
Currently the interface allows us to run a script which is great, but it would be more useful to have an interactive interface that allowed us to operate as if we were on the system.
-
How to change Runtime Powershell credentials/password
Our technical support AD credentials have changed passwords and now we are getting hundreds of machines trying to login with the configured AD account PowerShell User Impersonation credentials…locking the technician accounts. These machines are spread out at 19 separate locations and over 600 miles, at remote locations. How do we remotely modify the Runtime PowerShell user credentials on those machines? I have tried uninstalling and then reinstalling, but it absorbs the previous configuration…including the former PowerShell User credentials….I also tried calling tech support but was sent to voicemail. Help! Local Setings where credentials were entered: Remote Settings, no ability to enter or modify PowerShell User:
-
Install 7-Zip with PowerShell
I made a install script for 7-Zip to do a Silent install and clean if needed. Improvements are welcome! When a new version of 7-Zip comes out, just change the 7z1604-x64.msi to the new value. # Silent Install 7-Zip # http://www.7-zip.org/download.html # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "http://www.7-zip.org/a/7z1604-x64.msi" $destination = "$workdir\7-Zip.msi" # Check if Invoke-Webrequest exists otherwise execute WebClient if (Get-Command 'Invoke-Webrequest') { Invoke-WebRequest $source -OutFile $destination } else { $WebClient = New-Object System.Net.WebClient $webclient.DownloadFile($source, $destination) } Invoke-WebRequest $source -OutFile $destination # Start the installation msiexec.exe /i "$workdir\7-Zip.msi" /qn # Wait XX Seconds for the installation to finish Start-Sleep -s 35 # Remove the installer rm -Force $workdir\7*
-
Sendmail via Powershell
I have added a powershel script to Pulseway and scheduled it. On the Server the script is running well, but with Pulseway it has a problem to send a mail with the PS command: Send-MailMessage. + Send-MailMessage -To $user.EmailAddress -BCC $MailSender -Fr ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:Sm tpClient) [Send-MailMessage], SmtpException + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.Send MailMessage The command is: Send-MailMessage -To $user.EmailAddress -From $MailSender -SmtpServer $SMTPServer -Subject $Subject -Body $EmailBody What is the reason for the error ?? I use this script: https://4sysops.com/archives/a-password-expiration-reminder-script-in-powershell/
-
Update Pulseway Manager Settings - Powershell
I created a simple script to update the Pulseway Manager settings. The script verifies if a directory exists, and if it doesn't then creates it. Afterwards, it downloads the file from the URL and saves it to the outpath. Then updates Pulseway Manager config with the file located in the outpath. This has been extremely useful for modifying settings and updating all agents with the new settings. The flow for this process is as follows: 1. Update settings on the Pulseway Manager application, export settings. 2. Upload the settings file to a cloud or web-based URL, I use AWS S3 buckets with a public URL. 3. Add the URL to the $url variable, and change the paths depending on your environment. 4.Create a task on Pulseway to run this a few times, to make sure everybody has their settings synced up properly. **The config password should be blank if you didnt export with a password. If you exported with a password, put the password after configpassword=** $url = "url-to-site-that-hosts-file (s3 bucket, google drive, etc)" $outpath = "C:\IT\pulsewaysettingsupdate.pcmcfg" $path = "C:\IT" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path } $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile($url, $outpath) "C:\Program Files\Pulseway\PCMonitorManager.exe /config=C:\IT\updatedDomainSettings.pcmcfg /configpassword=auto@2017" updateSettingsForAgent.ps1
-
HELP - Successfully runs the Enable SSO PowerShell script via Pulseway RMM, but does not execute on the endpoint
It is vital to comprehend the difference in execution context between testing in Powershell ISE and using the Pulseway agent. While testing with Powershell ISE is done under a specific user account, Pulseway runs scripts as Local System. This variation may cause keys to be written to the physical registry location for Current Users after successful execution.sso login
-
Run PowerShell automation scripts with "-NoProfile"
Hi. When Pulseway executes automation scripts in PowerShell, it would be great if it could be executed with the "-NoProfile" argument. On some clients the profile scripts has been alter to load various modules, which will slow down or even conflict with the automation script. More info: http://www.powertheshell.com/bp_noprofile/ Best Regards, Martin.
-
Impersonation for Backup Monitoring
Hello, I am just trying to get this setup to monitor the backups on a 2012 R2 server. I see this article but I have some confusion on what needs done. How to enable and configure the Windows Server Backup monitoring | Pulseway Help Center (intercom.help) User in “Backup Operators” or “Administrators” user group configured in Pulseway Manager at PowerShell impersonation. Note: PowerShell Impersonation Setup Instructions are covered at Runtime Configuration. Not sure what it means by setup instructions are covered at runtime. I am currently using the domain admin account for settings things up. I am not sure on the "configured in Pulseway Manager at PowerShell impersonation" either. Thanks in advance.
-
Remove Dropbox with PowerShell
Here is a script to remove Dropbox with PowerShell. Be aware that your Dropbox could also be removed. #Script to remove Dropbox #This May remove your dropbox folder contents form your computer #By: Enrique Sanchez #Dropbox Paths $Dir = "C:\Users\" $drop = "\Appdata\Roaming\Dropbox" $dropM = "\Appdata\Roaming\DropboxMaster" $DropD = "\Dropbox" $StartM = "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Dropbox" $Short = "\Desktop\Dropbox.lnk" #Kill related processes taskkill /im dropbox.exe /f taskkill /im explorer.exe /f Get-ChildItem -name c:\users | foreach ($_) { Remove-Item -recurse -force $Dir$_$dropD -ErrorAction SilentlyContinue Remove-Item -recurse -force $dir$_$dropM -ErrorAction SilentlyContinue Remove-Item -recurse -force $dir$_$drop -ErrorAction SilentlyContinue Remove-Item -recurse -force $dir$_$StartM -ErrorAction SilentlyContinue Remove-Item -recurse -force $dir$_$Short -ErrorAction SilentlyContinue } C:\Windows\explorer.exe #End
-
Powershell User Context
I am trying to create a PowerShell script that will run DBCC checks on a SQL server and then report status back to Pulseway. I have a working script that I can run from the command line but the script will not run correctly when sent as a Pulseway script. Here are the details. The script fails because it is unable to authenticate to the SQL server. The SQL Server is running on the same machine as I am running the script on. Thus wil are not dealing with cross machine accounts. I have put debug code into the script and the account reported back by PowerShell is MACHINENAME$. The machine is in a domain and thus the script appears to be reporting back the machine account in the domain. This implies to me that when Pulseway runs a script it is using the NT AUTHORITY\SYSTEM account and that the MACHINENAME$ account would then be used for any network access. Is this correct? I have given SQL Server rights to NT AUTHORITY\SYSTEM as well as DOMAIN\MACHINENAME$ and NT AUTHORITY\LOCAL SERVICE. Non of these rights appear to allow me to connect to SQL. Has anyone ever written Powershell code for Pulseway and been able to connect to SQL Server? Any ideas, thoughts or details on the user contexts used by Pulseway would be helpful.
-
PowerShell command to disable the windows update notification
Hi, For many servers I want to disable the 'Send a notification when updates are available with priority' option. I would like to know if there is any PowerShell command which disables this function in the Pulseway Manager (Agent)? Kind regards, Laurens
-
Powershell Script to automate veeam backup jobs
Hi there, Are there possibility's to create a Powershell script which starts a Veeam backup of a VM which you can add to the Task section? We would like to automate the Windows Updates for the VM's, but before they update we would like to make a backup/snapshot of the VM first.
-
PowerShell Module to manage configuration of Pulseway Manager
A bit of introduction: I'm a happy user of Pulseway Manager. I use Pulseway Manager Enterprise (but for this topic it doesn't really matter). I manage quite large deployment with 250 Pulseway monitored machines. Someone else installed (via GPO) and did some basic setup. After running basic setup for a while, someone else changed some settings and tweaked it a bit. Finally ... again someone said lets change things around... This got me to this point... I have to change: CPU For all servers CPU > 90% for 30minutes > CRITICAL RAM RAM on 1 HOST – 5% for 30 min > CRITICAL Disable Low RAM on VM's Disable Low RAM in Azure Enable storage for any drives the servers have 20GB free > ELEVATED 10GB free > CRITICAL While I could just assign some poor guy to go thru 60+ servers and change things, make sure those are correct I decided it's time to introduce PowerShell for those Active Directory admins out there... while I know there is Pulseway GPO but it's kind of limited, and doesn't give much flexibility (for example drive monitoring). It also overwrites settings set locally without Pulseway actually showing them on Client. After playing a bit... I managed to write: Clear-Host Import-Module PSPulsewayManager -Force ### Tests - Account Page ### Get-PulsewayMaintenanceMode Set-PulsewayMaintenanceMode -Toggle $false -Verbose Get-PulsewayGroupName Set-PulsewayGroupName -GroupName 'EVOTEC' -Verbose Get-PulsewayComputerName Set-PulsewayComputerName -NewComputerName 'EVO1' -Verbose ### Set settings remotly... $Computer = 'AD1' Get-PulsewayMaintenanceMode -Computer $Computer Set-PulsewayMaintenanceMode -Computer $Computer -Toggle $false -Verbose Get-PulsewayGroupName -Computer $Computer Set-PulsewayGroupName -Computer $Computer -GroupName 'EVOTEC' -Verbose Get-PulsewayComputerName -Computer $Computer Set-PulsewayComputerName -Computer $Computer -NewComputerName 'AD1' -Verbose And another tab... Clear-Host Import-Module PSPulsewayManager -Force Import-Module PSWriteColor ### Tests - Notifications Performance Page ### Write-Color ' Get ', 'CPU usage below', ' settings' -Color Yellow, Green, Yellow Get-PulsewayCPUBelow Write-Color ' Get ', 'CPU usage above', ' settings' -Color Yellow, Green, Yellow Get-PulsewayCPUAbove Write-Color ' Get ', 'Memory', ' settings' -Color Yellow, Green, Yellow Get-PulsewayMemoryLow Write-Color ' Get ', 'Port Closed', ' settings' -Color Yellow, Green, Yellow Get-PulsewayMonitoredPortClosed Set-PulsewayCPUAbove -CPUUsagePercentage 25 -CPUUsageTimeInterval 20 -PrioritySendNotificationOnCPUUsage Elevated -SendNotificationOnCPUUsage Enabled -Verbose Set-PulsewayCPUBelow -BelowCPUUsagePercentage 2 -BelowCPUUsageTimeInterval 20 -PrioritySendNotificationOnBelowCPUUsage Elevated -SendNotificationOnBelowCPUUsage Disabled -Verbose Set-PulsewayMemoryLow -LowMemoryPercentage 10 -LowMemoryTimeInterval 15 -PrioritySendNotificationOnLowMemory Critical -SendNotificationOnLowMemory Enabled -Verbose Set-PulsewayMonitoredPortClosed -PortInterval 2 -PrioritySendNotificationOnPortNotAccessible Critical -SendNotificationOnPortNotAccessible Enabled -Verbose And another tab Clear-Host Import-Module PSPulsewayManager -Force Import-Module PSWriteColor $Computer = 'AD1' Write-Color 'Get ', 'Low Disk Space' -Color White, Yellow $Drives = Get-PulsewayLocalDiskSpace -Computer $Computer $Drives Write-Color 'List ', ' drives separatly' -Color White, Yellow -LinesAfter 1 $Drives.MonitoredDrives ## Find all drives for computer/server $FindDrives = Get-Drive -Computer $Computer $FindDrives $ListDrives = @() # Set the settings for all drives for particular computer/server (Elevated) $DrivesElevated = Set-DriveSettings -Drive $FindDrives -Percentage 10 -Priority Elevated -SizeMB 20000 -UsePercentage No # Repeat process for same drives but make it critical $DrivesCritical = Set-DriveSettings -Drive $FindDrives -Percentage 10 -Priority Critical -SizeMB 10000 -UsePercentage No $ListDrives += $DrivesElevated $ListDrives += $DrivesCritical Set-PulsewayLocalDiskSpace -Computer $Computer -Drives $ListDrives -SendNotificationOnLowHDDSpace Enabled -Verbose Since it covers my needs for now I was wondering if there is any interest in this? I don't want to spend time on it if there's no one else needing this I've published it on github https://github.com/EvotecIT/PSPulsewayManager But its also published in PowerShellGallery which allows you to install it .... Install-Module PSPulsewayManager Import-Module PSPulsewayManager Use the commands.. Keep in mind I've not spent a ton of time on it. There are bugs, some things are not checked.. but it does work ;-)
-
Remote Control not working after internal network IP changed.
After changing the internal IP on a client's network, I can no longer connect to the workstations using the Remote Control. I still can connect through the command prompt and PowerShell. All those machines are Windows 10/11. However, I can still Remote Control the Windows Server 2019 server. Always getting this error: Any ideas?
-
Powershell: "An error occurred when loading the system Windows PowerShell Snap-Ins."
Dear All, I'm having some trouble trying to run Windows Powershell commands via PC Monitor (Android App). When I send any command, I get back the following message: "An error occurred when loading the system Windows PowerShell Snap-Ins. Please contact Microsoft Support Services." This is displayed in the PowerShell terminal window inside the PC Monitor app. Has anyone seen this problem before? Or have any ideas how to fix it? I'm running: - one Windows Vista Home Premium SP2 machine. - one Windows 7 Starter machine. I get exactly the same error message when attempting to send commands to both machines. They both have the .NET framework that came with the install, I've not installed any additions, or any new version of PowerShell. Indeed, the Windows 7 machine is quite new and has few bits of third-party software installed on it. In addition, I run PowerShell scripts from the desktop on both machines without any problems, and with users that are not admins. I've never seen anything like this message on the desktop. Any help would be greatly appreciated. Google has turned up a few things, and I've attempted some of the solutions but with no joy. Simon
-
Update plugin DLL-file from PowerShell
Hi. I am making an Automation Script that updates a custom plugin-file, that might is always be in use, to a newer version. If the plugin doesn't already exist everything works fine. But if it already exist it cannot be overwritten, because the Pulseway Service (and managers, if any are running) is using the file. My solution is to stop the service, overwrite the file and start the service. It works very well when executing manually in ISE, but not when executed as an Automation Script from Pulseway. It looks like the entire script is terminated when the service stops, and the execution doesn't return anything in execution history - not even an error. Could anyone help me with the best practice for updating a plugin dll-file from an Automation Script. Best Regards, Martin Stevnhoved
-
The system cannot find the path specified
Hi, I am new to pulseway. Have written the following PowerShell script which works fine on my test machine. Clear-RecycleBin -Force However when run from pulse way it reports the script has run successfully but nothing is deleted from the recycle bin. The following error is shown in execution details: Clear-RecycleBin : The system cannot find the path specified At C:\Program Files\Pulseway\automation_b6682084_076f_4d67_80a0_0200e70e0897.ps1:1 char:1 + Clear-RecycleBin -Force + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (RecycleBin:String) [Clear-RecycleBin], Win32Exception + FullyQualifiedErrorId : FailedToClearRecycleBin,Microsoft.PowerShell.Commands.ClearRecycleBinCommand I have tried: cd \ Clear-RecycleBin -Force But same results. Is this a permission issue, that does not allow the script to run ?
-
Unitrends Backup Agent
I've recently disabled powershell.exe for users to run directly and was notified by those users that they've seen a Windows Script Host error. The error is C:\PCBP\UnitrendsScripts\ApplySambaCredentials.vbs, line 14. That line leads back to a call on powershell.exe to run ManageSambaCredentials.ps1. Since this is the only change I've made in recent memory that would cause this behavior, is it not possible to run Unitrends Backup Agent if powershell.exe is disabled for the user? The comment in the .vbs states "This script is necessary so the ManageSambaCredentials.ps1 powershell script call be called by the system with no visible window." Any information about this would be appreciated.