PowerShell
Share your PowerShell scripts
112 topics in this forum
-
This script will check to see if a VPN connection with the given name exists. If it does exist, it updates the VPN connection. If it does not exist, it creates a VPN connection with the given values. Note: I believe Pulseway runs PowerShell scripts under the Local System account by default (unless you have defined PowerShell User Impersonation in the Pulseway Manager, I think). In order to expose the VPN to users, this script runs against the Global Phone Book (-AllUserConnection switch). Therefore, this script does not check for the existence of VPN profiles stored in individual user Phone Books. (If an existing user VPN profile exists, this script will create a new…
-
- 4 replies
- 21.2k views
-
-
I am looking fo a script that I can deploy where Pulseway can check to see if a specific local admin account has been created. If not have it create it. With that local admin account, there is a rotating password, which is recorded in a report per computer.
- 2 replies
- 3.8k views
-
What do folks consider best-practice for this? I need to push out a very small app, but PW has no file storage which seems like a HUGE roadblock.
-
- 1 reply
- 2.1k views
- 1 follower
-
-
We do not use IPv6 in our current environment, so to help with security, we disable it on the network adapters. The below script is what we run when an asset registers with Pulseway. Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6
-
- 0 replies
- 3.3k views
-
-
For our client security audits, and PEN testing events, we are required to disable NetBIOS on the network adapters. The below script is what we run when an asset registers with Pulseway. $key = "HKLM:SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces" Get-ChildItem $key | foreach { Set-ItemProperty -Path "$key\$($_.pschildname)" -Name NetbiosOptions -Value 2 -Verbose}
-
- 0 replies
- 1.8k views
-
-
I've written a script that retrieves the application name, publisher and version from the registry entries located in "HKLM:\Software\MMSOFT Design\PC Monitor\InstalledApplicationsSnapshot". How can I make sure the software versions listed in this location are updated to the latest version of the applications installed? Is there a way to force update these records? For example, I have a mismatch in a system that the PW web dashboard is reporting Citrix Files being at version 20.9.1.0 (which is correct as of the last 24 hours), and the local registry entry for this application under the PC Monitor\InstalledApplicationsSnapshot is still reporting the previous version 20.…
- 4 replies
- 3.5k views
-
I've implemented a script that retrieves and stores the Windows Build Version number to a custom field in the system overview. It works fine on MOST systems. However, there are a small number systems that are unable to run the script. The error message displayed includes: Start-Process : This command cannot be run due to the error: The system cannot find the file specified. I used the "Insert Output Variable Code" in the script and verified that it includes the inserted text "Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable .....". For some reason, a few systems do not seem to have the environment variable PWY_HOME set. It ap…
-
- 2 replies
- 2.7k views
- 1 follower
-
-
Not my work, I took code form two locations and put them together to fit my needs, change the path to the path to your folder, change the filter to the file type to filter by, add as a script, run it, and then open your Last Executions to see the contents of the file. I was needing to check status of a log file on a server every so often, the log file name would change daily and be time stamped, this solved it for me. $dir = "C:\data\Sync_Reports" $filter="*.txt" $latest = Get-ChildItem -Path $dir -Filter $filter | Sort-Object LastAccessTime -Descending | Select-Object -First 1 $latest.name Get-Content $dir"\"$latest
-
- 1 reply
- 5.9k views
-
-
This has been bugging the h ell out of me, I need to map a drive, or run a program that can only be run by the logged in user, and if I map the drive from session 0 the user does not see it. The below script works but wish Pulseway had better run as user features built in. This script will map a drive letter for the logged in user, change server and share name to your info. you can change the /TR "any commoand you want to run as the user" $Taskname = "MapX" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $T…
-
- 5 replies
- 4.9k views
-
-
Ok this guy will display the users mapped drive of the user thats logged into the pc as well as the status of the drive, disconnected, Ok, ect... Nice if you's setting up another pc remotely and you want to see what the shared drives on another users pc were so you can match them. #by eDecisions $Taskname = "netuse" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $Taskname /RU $lastlogon /TR "c:\maplist.bat" start-sleep -s 1 New-Item c:\maplist.bat -ItemType "file" Set-Content c:\maplist.bat 'net use…
-
- 0 replies
- 2.5k views
-
-
Script enables RDP if its disabled, and enables if its disabled. #By eDecisions $RDP = (Get-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server').fDenyTSConnections If ($RDP -eq 0) { Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value "1" } IF ($RDP -eq 1) { Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value "0" }
-
- 0 replies
- 2k views
-
-
This script changes the state of Hidden files, if hidden files are set to show this turns them off, if hidden files are set to hide this shows them. Comments? # This key contains all of the profiles on the machine (including non-user profiles) $profileList = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" # This key contains the path to the folder that contains all the profiles (typically c:\users) $profileFolder = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList').ProfilesDirectory # This key contains the path to the default user profile (e.g. C:\Users\Default)…
-
- 0 replies
- 2.6k views
-
-
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 $so…
-
- 2 replies
- 9.5k views
-
-
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
-
- 2 replies
- 2.3k views
-
-
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 ex…
- 3 replies
- 30.3k views
-
I made a basic script to run diskcleanup silently, I already configured it...and the script seems to execute the disk cleanup on the local machine but it runs indefinitely, meaning pulse way doesn't seem to know when the script is done. ..any help is appreciated cleanmgr /verylowdisk /sagerun:5
-
Hi, I am trying to install GCPW (Google Credential Provider for Windows). I am running into issue where with it: <# This script downloads Google Credential Provider for Windows from https://tools.google.com/dlpage/gcpw/, then installs and configures it. Windows administrator access is required to use the script. #> <# Set the following key to the domains you want to allow users to sign in from. For example: $domainsAllowedToLogin = "acme1.com,acme2.com" #> $domainsAllowedToLogin = "" Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName PresentationFramework <# Check if one or more domains are set #> if ($domainsAllowedToLogin.Equal…
-
- 1 reply
- 5.2k views
-
-
Don't you hate it, turn on the computer and you got all this cra# that comes up before you can start using your computer, users had enough of it, and go figure Microsoft put the run commmand in HKCU rather than HKLM I can't take credit for this one, I added the remove the run item but the balance of the script I found on ChristopherKibble.com, this script loops thru every users of the computer and edit's their HKCU, you run the script once and its fixed for all users on that system. #******************************************************************************************************************************* #** All code is for demonstration only and s…
-
- 2 replies
- 3.3k views
-
-
I use this when I am onboarding a new client. Computers have been there and most people don't know/have their own admin password
- 13 replies
- 14.2k views
- 1 follower
-
Seems I still find a lot of these systems that were managed by 2011 small buiness server where the server has been removed from the domain but the WUSU settings were not removed from the GPO correctly leaving one or more systems looking for a server that no longer exist. This script removes and reset the update service back to default on the client. Suggestions/Comments? # Stop the Windows Update service Stop-Service -Name wuauserv # Remove the registry key Remove-Item ` 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' ` -Recurse # Start the Windows Update service Start-Service -Name wuauserv
-
- 0 replies
- 1.9k views
-
-
Well until Pulse-way get around to integrating Bitdefender I needed some way to quickly see who was installed and who was not, this scrip adds an entry to the computer name as "NoBit" or "BitActive" depending weather or not the bitdefender service is found or not. then just visit Systems, Key in the name filed NoBit and hit search to see which clients are missing Bitdefender. Note, does not check if service is running or actually active, only that the service exist. Suggestions Welcome. #Written by eDecisions #Use to determine if Bitdefender is loaded $computername = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\…
-
- 0 replies
- 2.7k views
-
-
So, I have this: Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\" -Name ComputerName -Value "$env:UserName" Which works great from the local machine via PowerShell, However, when I try to run this as a script/task, the name just shows up as "HOSTNAME$" Any ideas why?
-
- 8 replies
- 6.8k views
- 1 follower
-
-
Disable IPv6 All Network Adapters, the second line allows you to check status of all adapters after run. Carefull, suggest you run on workstations only. Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6 Get-NetAdapterBinding -ComponentID ms_tcpip6 Enable IPv6 All Network Adapters enable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6 Get-NetAdapterBinding -ComponentID ms_tcpip6
-
- 0 replies
- 2.8k views
-
-
I'll circle back and create an array and loop thru the array later, but this should give you an idea where its heading, this script will remove any current excluded items so be carefull, and it will turn off monitoring on just the ones in the script, I use this to reset all clients to the same set of excluded services, the array will be nice to have all the excluded services listed at the top of the script. Remove-Item -Path "HKLM:\Software\MMSOFT Design\PC Monitor\ServicesExcludedFromNotifications\" -Recurse New-Item -Path "HKLM:\Software\MMSOFT Design\PC Monitor\ServicesExcludedFromNotifications\" Set-Itemproperty -path 'HKLM:\SO…
-
- 1 reply
- 2.1k views
-
-
1: ENABLE MANAGER LOCK (PASSWORD 123) Set-Itemproperty -path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor' -Name 'PreventChanges' -value '1' Set-Itemproperty -path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor' -Name 'PreventChangesPassword' -value 'u9jnMTCy8Op4FP7ojbHApnslkq4g2bxhTW8uvNKsURYntjFyJKp302SXGSI+d7lCghuzlNhB6kZb71JpwMiHIw==' Set-Itemproperty -path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor' -Name 'PreventChangesPasswordCtrl' -value 'A1-B9-23-A3-6D-C6-BD-A4-DF-CE-82-F5-F3-F6-69-81' 2: DISABLE MANAGER LOCK: Set-Itemproperty -path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor' -Name 'PreventChanges' -value '0' Set-Itemproperty …
-
- 0 replies
- 2.7k views
-