PowerShell
Share your PowerShell scripts
112 topics in this forum
-
When entering the following, script, I get an error. The error message indicates that the script is adding a "$" character to the device name, and I can't figure out why. This script has been tested verbatim, working, as a locally-run script.. It will not work when pushed through Pulseway's Powershell automation. (generic PREFIX- inserted for relative anonymity) Screesnshots of Pulseway script Syntax attached, as well as identical, locally run syntax. #### $name = $env:UserName $oldName = $env:ComputerName $newPCName = "PREFIX-" + $name Rename-Computer -ComputerName $oldName -NewName $newPCName ### The error message viewed through Pulse…
- 1 reply
- 3.4k views
- 1 follower
-
Here is a script for Powershell to set the pc to autologon one time [configurable] after restart, with a 15 sec delay Someone may find it handy Copy paste into Powershell ISE or txt and then rename to *.ps1 Tested on Windows 7 X64 $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $DefaultUsername = "Insert Username Here" $DefaultPassword = "Insert Password Here" Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String Set-ItemProperty $RegPath "DefaultUsername" -Value "$DefaultUsername" -type String Set-ItemProperty $RegPath "DefaultPassword" -Value "$DefaultPassword" -type String Set-ItemProperty $RegPath "Auto…
- 1 reply
- 7.1k views
- 1 follower
-
I created a script to install an MSI installer. However is I point to a Mapped Drive such as Z:\Working Directory\Installer.MSI it does not execute. If I execute the script from the C:\Temp\Installer.MSI it installs successfully. I've even tried using a UNC Path \\SERVERNAMER\Working Directory\Installer.MSI and it does not execute. Why is this? Does Pulseway not have permission to see the network share? Is there an area when creating the task that I need to enter network credentials. I don't see this. Please advise what I am doing wrong or overlooking Greg
-
- 3 replies
- 7k views
-
-
Good evening, I would like to use the standard script for windows that is in pulseway automation. But I get this error message: Checking for Windows updates Downloading updates Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) At C:\Program Files\Pulseway\automation_9fdca742_c373_41fb_80e3_ce2b245530ca.ps1:25 char:5 + $Downloader = $Session.CreateUpdateDownloader() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException The user used to execute the script (Settings…
- 6 replies
- 7.6k views
-
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…
-
- 2 replies
- 3.4k views
-
-
Pulseway doesn't seem to send the following script to create an INI file correctly to the target computer. The script runs fine on local Powershell, but it creates a setupconfig.ini file with text as a long string when run through Pulseway. $fqdn=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain $fqdn=$fqdn.Substring($fqdn.IndexOf(".") + 1) $sysfolder="\\$env:computername\sysvol\$fqdn\policies\" $setupconfig="\\$env:computername\sysvol\$fqdn\policies\setupconfig.ini" $functiontext = @" [Setupconfig] auto=upgrade BitLocker=AlwaysSuspend Compat=IgnoreWarning Priority=Normal DynamicUpdate=Enable ShowOOBE=None Telemetry=Enab…
- 2 replies
- 2.6k views
- 1 follower
-
Hi, I'm trying to give all my users a new rdp icon on their desktop to log into our remote environment. How would I do so using powershell? I know .bat would work as well but Im not sure how I would go about it using pulseway.
-
- 3 replies
- 3.3k views
- 1 follower
-
-
I want to set the period of by powershell Maintenance . I attach the powershell file which does not work ERROR : In C:\Program Files\Pulseway\automation_e4ae5e7d_784d_41fe_a512_7364b59decf2.ps1:394 car:14 + $value = "723" + ~ Carattere di terminazione mancante nella stringa: ". + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx ception + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString if you run the file locally on the server everything works, if imposed a console script does not work. Maintenance.ps1
-
- 1 reply
- 3k views
-
-
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 $SMTP…
-
- 1 reply
- 4.8k views
-
-
This is more of a general script question about Pulseway. There are a number of the built-in script that appear like they should return data. When I review the scripts they are PowerShell scripts that would return data to the screen. I don't understand where the data is returned when they are run remotely via Pulseway. Is there someplace that Pulseway returns the data from a script after it is run? This would be super convenient but I surely cannot find this. Examples: List Installed Hotfixes List System Restore Points List Computers in the Active Directory These are built in but I don't understand where the results are supposed to be r…
-
- 4 replies
- 4.7k views
-
-
I've written a script to scan the network and insert all existing active IP addresses to the proper location in the registry, however Pulseway manager doesn't pick that up (even on service restart). Where do I need to insert those changes? Sample script below- It relys on a txt file for a list of active IP's (generated separately) cls # Remove any existing registry entries $ExistingKeys = Get-ChildItem "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\" | Select-Object -expand Name $Count = 0 ForEach ($Key in $ExistingKeys){ Remove-Item "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" $Count++ } …
-
- 1 reply
- 2.7k views
-
-
Hi, Is it possible to continue a script after a reboot using Tasks? I build a PowerShell script where a reboot is required and needs to continue after te reboot.
-
- 3 replies
- 4.2k views
-
-
Hi, We created a script which checks for Windows Updates, installs the updates, creates a report and reboots if necessary. This script runs in a single task and every system has it's own scheduled task. Unfortunately when I check the Script Output Results (where our report file is shown), I noticed the following error: "Download Status: FAILED With Error -- You cannot call a method on a null-valued expression. The property 'Updates' cannot be found on this object. Verify that the property exists and can be set. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))()" (See the attachment for a more detailed Script Output, the script is als…
-
- 1 reply
- 3.5k views
-
-
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-…
-
- 1 reply
- 14.4k views
-
-
We noticed that all machines we had with Win 10 either via fresh install and or upgrade would not WOL from Pulseway. Through much troubleshooting and testing it came down to the fast startup option in the power settings preventing WOL from happening. We setup a PS script to change the regkey value for fast startup and set it to disabled. After a restart and processing of the registry the systems now wake when requested to via Pulseway RMM. PS script is below... Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power' -Name HiberbootEnabled -Value 0
-
- 1 reply
- 4.7k views
-
-
Hi, Is there a script to remotely enable o provide remote support the remote desktop client and ask users permission for connection? I have a number to remote users and would like to provide remote support to them Thanks Nick
-
- 3 replies
- 8.2k views
-
-
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 …
-
- 1 reply
- 5.7k views
-
-
Small Correction: The scheduled task can be run on demand, but by default it restarts the pulseway service once a day at 11am, which in theory, should force it to check for updates. So one of the problems I ran into with pulseway is, sometimes I would want to restart the service. Doesn't really matter why, could be to get it to check for new updates to the pulseway agent and get them on the latest version. The problem was that if I just setup a script to restart the service, say like this ReStart-Service "Pulseway" what would happen is that it would send the command in whatever user environment pulseway runs in, it would execute it, the service would stop, and the…
-
- 1 reply
- 6.2k views
- 1 follower
-
-
This script will download the small online installer, generate the silent install cfg file and run the installer. The timer near the end is set for 3 minutes as it has to download the full installer first and Java takes a while to install anyway. If you want to get the latest version just go to https://java.com/en/download/win10.jsp and copy the link from the button that says "Agree and start free download". Then past this link into the $source variable. I find that this installer works on both windows 7 and windows 10. # Download and silent install Java Runtime Environement # working directory path $workd = "c:\temp" # Check if work directory …
-
- 0 replies
- 26.5k views
-
-
This will download and install or upgrade veeam and install a license if you have one, finally it will import a config file if one is available. I use Dropbox and a shared link. When using Dropbox be sure and change the zero at the end to 1 to download. You if course would have to update the dl links. Any questions let me know. VeeamInstall.ps1 ## $workdir = "c:\installer\" $LicenseFile = "$workdir\Veeamlicense.lic" $ConfigFile = "$workdir\config.xml" [Object[]]$List = @( New-Object -TypeName PSObject -Property @{"File" = "$workdir\Veeam2.exe"; "URL" = "https://www.dropbox.com/s/Veeamexedl=1"} New-Object -TypeN…
-
- 1 reply
- 5.8k views
-
-
I made a install script for MalwareBytes 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://data-cdn.mbamupdates.com/web/mb3-setup-consumer-3.0.6.1469.exe # Silent Install MalwareBytes # Download URL: https://www.malwarebytes.com/mwb-download/thankyou/ # 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 …
- 4 replies
- 17.9k views
- 1 follower
-
Hi, is it possible to use the PowerShell scripts from https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc (= PSWindowsUpdate) over Pulseway. My idea is to create a new category unter Automation -> Scripts with all the scripts of PSWindowsUpdate, but I have no idea if they would work... Thanks, Christian.
-
- 2 replies
- 3.9k views
- 1 follower
-
-
This script will set the virtual machine to auto start whenever the host reboots, it will also update Hyper V integration services. Be sure and change your server names to match. Server0 is host and server1 is the Hyper V. Run on Host. Get-VM –VMname * | Set-VM –AutomaticStartAction Start Get-VM -Name SERVER1 –ComputerName server0 Set-VMDvdDrive -ComputerName server0 -VMName SERVER1 -Path 'C:\Windows\System32\vmguest.iso' $DVDriveLetter = (Get-VMDvdDrive -ComputerName server0 -VMName SERVER1).Id | Split-Path –Leaf Invoke-Command –ComputerName SERVER1 -ScriptBlock { if ($ENV:PROCESSOR_ARCHITECTURE -eq 'AMD64') { $folder =…
-
- 0 replies
- 3.8k views
-
-
This script will update Hyper V integration services. Be sure and change your server names to match. Server0 is host and server1 is the Hyper V. Run on Host. Get-VM -Name SERVER1 –ComputerName server0 Set-VMDvdDrive -ComputerName server0 -VMName SERVER1 -Path 'C:\Windows\System32\vmguest.iso' $DVDriveLetter = (Get-VMDvdDrive -ComputerName server0 -VMName SERVER1).Id | Split-Path –Leaf Invoke-Command –ComputerName SERVER1 -ScriptBlock { if ($ENV:PROCESSOR_ARCHITECTURE -eq 'AMD64') { $folder = 'amd64' } else { $folder = 'x86' } Start-Process -FilePath "$($using:DVDriveLetter):\support\$folde…
-
- 0 replies
- 5.5k views
-
-
Wrote this script with the help of Support. Thanks Ermins! $days = 35 $system = Get-WmiObject win32_operatingsystem if($system.ConvertToDateTime($system.LastBootUpTime) -lt (Get-Date).AddDays(-$days)){ Restart-Computer -Force }else{ Write-Host "Machine was rebooted less than $days days ago" }
-
- 2 replies
- 10.9k views
- 1 follower
-