Questions tagged [script]
An automated series of instructions carried out in a specific order, such as a Windows script created to launch a specific program on startup.
2,743
questions
0
votes
0
answers
1k
views
How to set the local user account photo with PowerShell?
I want to set the local account photo (the image that shows up in the start menu and above the password prompt when logging in) using PowerShell and an image saved in a certain location.
the same as ...
1
vote
1
answer
1k
views
Is it possible to reboot from within Windows to another installed Windows version?
My blind friend has to use both Windows 7 and Windows 10. Her trusted old external audio interface does not have drivers for Windows 10, so she uses Windows 7 for work when she records cassettes to ...
1
vote
0
answers
225
views
A script to turn on focus assist for specific duration?
I am looking for a script/application for Task Scheduler on my Windows 11 to turn on focus assist for specific duration (50 mins for example).
I have Power Automate & Task Scheduler on my Windows ...
0
votes
0
answers
58
views
How can I obtain the names of the Windows lockscreen "Spotlight" locations?
I already have a little batch file that I run every so often when I see a photo I like on the Windows lockscreen, but it would be nice to be able to remember where it was taken (you know how in the ...
1
vote
1
answer
263
views
for loop through all folders and execute vbs issue
i trying to code a script where it loop through all folders including subfolders however i encounter some errors. It run all *.vbs instead of only Installation.vbs.
In my root folder, i have a folder ...
0
votes
1
answer
1k
views
How can I dynamically hide and unhide the taskbar?
I want to be able to have my taskbar auto-hide when I'm focused on my desktop instead of any windows. I should be able to still hover my mouse down at the bottom to reveal the taskbar, but I just want ...
1
vote
0
answers
239
views
How to Pin to Bottom/Desktop UWP Application Using AHK Windows 10
I'm aware of using setParent from DLL in Windows and I can pin Win32 application on Windows already with this script
#o::
Current := WinExist("A")
;ParentID := WinExist("ahk_exe ...
0
votes
0
answers
586
views
How to Select Highest Value Folder Name in Powershell Using Wildcards?
I'm writing a script to kill and restart Google Drive for desktop. I also need it to account for new versions. On my test machine, the executable was stored in:
C:\Program Files\Google\Drive File ...
1
vote
1
answer
2k
views
How to make apache service run continuously from script file from docker?
I am trying to run apache2 service from .sh script from dockerfile. The 'sh' script contains 3 executable commands which is presented as below:
#!/bin/bash
export DISPLAY=:0.0
echo "pvw ...
1
vote
1
answer
8k
views
How to check if process is running properly in Powershell?
I'm writing some powershell to check if the Google Drive for Desktop process is running. If it is, I need to stop it and restart it. I'm having trouble understanding how to avoid throwing errors if ...
0
votes
1
answer
29
views
CLI script works. Alias script broke. Corrective action is?
This CLI (Command Line Interface) script works.
This script is 688 characters with spaces.
This script shows: directories, files, totals in
current directory and
recursive directories (down the file/...
1
vote
2
answers
1k
views
Why is change directory not working when SETLOCAL ENABLEDELAYEDEXPANSION is used
I have an existing windows batch script (named as test1.bat) as below :
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set nop=4
for /l %%z in (1, 1, %nop%) do (
set x=%%z
echo !x!
)
chdir /d D:\app\
...
2
votes
2
answers
11k
views
How to run a PowerShell script at logon for all (current and future) users with elevated permissions without UAC
I'm building a login script for our company. Some of the things it will do include installing printers, mapping drives, setting wallpapers, etc. Many of these things will require elevated permissions....
0
votes
1
answer
776
views
How to automate sftp and remote shell calls?
I am on windows and I have remote linux server. I do not have admin access to neither of them. I have following set of steps/commands
cp C:/ ... /file.war C:/temp/update/file.war
sftp server
write ...
0
votes
0
answers
124
views
How to install outdated packages using chocolatey
#step 1) Installing Chocolatey when needed
if (-not (Test-Path -Path "$env:ProgramData\Chocolatey\choco.exe" -PathType Leaf))
{
# from https://chocolatey.org/install
Set-...
0
votes
1
answer
242
views
PowerShell Modules in System32 - Are these standard defaults?
I have been experimenting with PowerShell and noticed there are a ton of modules in C:\Windows\System32\WindowsPowerShell\v1.0\Modules
Here's a list of everything in that folder:
AppBackgroundTask
...
0
votes
1
answer
166
views
Merging switch config in Notepad ++ Tips
The document and config is much bigger than this but for example.. I have the config all documented out in excel and I want an easy way to transfer this config to the switch without going back and ...
0
votes
1
answer
1k
views
PowerShell - Close running script with another script
I have 3 PS Scripts, STOP.ps1, FORM.ps1 and ENABLE.ps1.
ENABLE.ps1 will create a task in task scheduler that opens the FORM.ps1 script every hour.
Once the FORM gets opened, there is a button to close ...
0
votes
1
answer
706
views
Modify user in openLdap via bash script
Can you please help me put this command into if statement (bash scripting):
$ ldapmodify -D -h
password: [enter password]
dn: cn=vipb,ou=groups,dc=example,dc=com
changetype: modify
add: memberUid
...
1
vote
1
answer
2k
views
PowerShell - Allow non-admin users to disable/enable Tasks
I have a task that triggers every hour, and runs a powershell script. I am supposed to deploy this script along with the task on workstations, where all users are non-admin users, however, the users ...
1
vote
1
answer
3k
views
How to run a script when the screen is turned off for being idle?
just wondering whether its possible to run a script when Windows turns the screen off after a period of inactivity (not sleep or hibernate but just switching off the screen) as well as when the user ...
1
vote
1
answer
222
views
does robocopy kill files while mirroring if read error?
my params is /mir /copyall /dcopy:t /z /v /tee /eta /unilog+ /mt:32 /r:3 /w:30
for example, some copying finishes ok
so, is read error "equal" no-file? will robocopy delete file at ...
0
votes
3
answers
2k
views
How do I copy the IPv4 IP Address from ipconfig to clipboard?
I want to get the ipv4 192.168.1.* from the ipconfig. I'm learning scripting and want to make an output value message box that displays the ip and copies it to clipboard. I have already done this by ...
0
votes
1
answer
3k
views
PowerShell script to move files in a new directory and rename them - how to avoid duplicate collision?
The situation is as follows. I have a folder where files are dumped on a daily basis (mostly PDF). I am trying to write a script that does the following:
Go through all the files in the folder and ...
2
votes
1
answer
300
views
Bulk-convert shortcuts to target
(Windows10) Sometimes I need to create a subset of a master photos folder, but I am trying to be cute and save space by creating the SUBSETFOLDER somewhere, then selecting the pictures I want, right-...
0
votes
1
answer
851
views
How to reassign the "Sign out" shortcut on Windows?
I often find myself mistyping the "Sleep" shortcut as "Sign out". So I want to disable the shortcut for it, i.e. Win+XUI:
And reassign it to Win+XUO, how to achieve this using ...
0
votes
1
answer
567
views
AutoHotKey - switch statement with a series of InStr functions
I have created an AutoHotKey script with a bunch of if functions that rely on InStr, similarly as in the example below, and it already does what I want. Is it possible, though, to convert it to a ...
6
votes
1
answer
4k
views
read in Bash and ZSH
I'm observing differences between zsh and bash when using read on macOS.
With bash this script
echo "characters" | while IFS= read -d '' -n 1 a; do printf %s "$a-"; done
Produces
...
1
vote
1
answer
989
views
Do I have to put `SetTitleMatchMode` on top of the script?
Sample script:
#NoEnv
#Warn
#SingleInstance Force
#IfWinActive Foo ahk_exe foo.exe
!A::Send Foo
SetTitleMatchMode Regex
#IfWinActive Bar$ ahk_exe bar.exe
!A::Send Bar
When running it, it ...
0
votes
1
answer
579
views
Get DisplayName of domain users who are members of local groups
I have a script which lists all local groups and their members and give CSV output.
I modified script to get displayName property of domain user members of local groups (Not domain groups not local ...
0
votes
1
answer
584
views
How to resolve a hotkey conflict?
I bound Alt+Space to an action, for example:
!Space::Send, Foo
Now how to trigger the original Alt+Space's action (as shown in the image below) through code?
0
votes
0
answers
461
views
Why Power Automate do not run my script?
I use Power Automate (not desktop version). My flow seems simple:
Every weeks
Copy file (From folder A to folder B in the same SharePoint). Replace existing file.
Run a script in the file (removes ...
1
vote
1
answer
126
views
Start programme on startup, but only when on laptop power
I have a programme called rainmeter which displays the time and date the second monitor i have plugged into my laptop which currently just runs on startup, but when I unplug my laptop and go to uni ...
1
vote
1
answer
2k
views
How to trigger an action if there's only one key being pressed?
Here's my current script:
Shift::Send ^{Space}
It doesn't only trigger ^{Space} on pressing Shift alone, it also triggers on Alt+Shift (just these two keys) and Ctrl+Shift (just these two keys) if ...
0
votes
1
answer
409
views
how to extract strings from text file using regexp or powershell?
Having a text file with
<td><tr>id"2222"</td></tr><td><tr>id"3333"</td></tr>
etc
I would want to extract every string that is ...
0
votes
1
answer
54
views
Where am I going wrong with foreach when i try to get my script to run against each individual string in my results?
I have a Users.log file that lists the following information pertaining to Usernames, group memberships and assigned server paths extracted from AD:
RandomUser01,RandomGroup01_654321_098765,\\server\...
3
votes
1
answer
17k
views
How to read excel using Powershell
How to extract data from excel such that in first column having the details of machine and in second column having multiple user name and it read excel like it will delete all users from column 2 ...
0
votes
1
answer
4k
views
Execute powershell script with different credentials
I am trying to write a script, which asks for credentials via the "Get-Credential" cmdlet
and then executes the logic part with the given credentials.
I know I could write a second script ...
1
vote
2
answers
3k
views
Powershell script to delete multiple user profile on multiple server
Showing error that "remove-localUser" is not recognised as the name of cmdlet....
$hostdetail = Import-CSV C:\Users\jj\Desktop\Test\hosts.csv
ForEach ($item in $hostdetail)
{
$hostname = $($...
0
votes
0
answers
178
views
How to fetch the name of all user on remote server which is present at 'C:\user' folder and write that name into Excel file [duplicate]
I am trying to get the name of all users of multiple server through powershell and than transfer it to excel file but I only got the name of user in txt file and unable to copy it to excel.
Foreach($...
0
votes
1
answer
92
views
Script won't for more than one group when looking at results of whoami command
Trying to setup IF/ELSE on a script whereby it checks for two conditions to be met before the script runs:
Check if the following file exists on the desktop. ($FileExists)
Check if the user is a ...
2
votes
1
answer
401
views
How can I parse the text from these results into parameters for a separate script?
I need to extract client_TargetText and AnotherTargetText_110953_140521 from the results I get when running the whoami /groups command:
Powershell Results:
Group Name ...
0
votes
0
answers
181
views
script that will monitor changes in at least 2 files/directories and execute a third script only when both are modified
I have two sensors that each create an entry in a text file when triggered. Now I need something to monitor these two files (i can also put them in 2 directories each if that helps in any way) and ...
0
votes
0
answers
115
views
Can I write a script that automatically toggles my Wifi band (2.4 or 5 Ghz) based on available networks?
I have a 15" Surfacebook2 (with fully updated Windows 10 as of 7/25/2021). The network card doesn't allow you to "prefer" a band...it just has "auto", "2.4 Ghz only" ...
0
votes
1
answer
184
views
Run .cmd file every x minutes when app is being used?
I'm trying to find a way to incrementally back-up a folder every 15 minutes, but only if VS Code has been used/in focus since the last time it was backed up.
Does anyone have an idea for how I could ...
0
votes
2
answers
2k
views
Speedtest Ookla No Timestamp in CSV output
So when running the official speedtest client from Ookla and outputting to a CSV file, I've noticed the output has no timestamp field. The JSON does, but I'm not particularly savvy with jq and trying ...
0
votes
1
answer
526
views
BASH - How to combine data from 2 files
I have 2 files with the following data
file1:
datapoint1name##datapoint1name
datapoint1name.PercentUtilization=
datapoint2name##datapoint2name
datapoint2name.PercentUtilization=
datapoint3name##...
1
vote
0
answers
179
views
Decoding a batch script which uses FFMPEG, EXIFTOOLS and EXIV2 to create VR180 and VR360 panorama images like Google Cardboard
I am struggling to figure out 2 things:
Why this script is completely invisible to google
How such script works (much more important than point 1...)
To better study the script, I instrumented it ...
0
votes
2
answers
35
views
if statement - simple bash scripting
I am working on a simple script that checks if there is .vimrc file and what is configured in that file:
if [ "$(ls -a /root | grep .vimrc)" = ".vimrc" ]; then
echo "...
1
vote
1
answer
3k
views
ROBOCOPY command gives me error if owner is set to group instead of user
I want to copy folder structure with permissions using this command: ROBOCOPY "source" "destination" /E /copy:DATSO /NP /MT. It works only if source folder is owned by the user ...