Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [scripting]

A form of computer programming that — in the context of system administration — lends it self well to automating tasks.

-4
votes
0answers
21 views

Display file name in first while excel append in powershell [on hold]

I have 10 excel files to append. My requirement is in result file, file name should come first then worksheet data. So I have used below script. Excel appending is working fine But first file name ...
-2
votes
0answers
22 views

folder with +1k files sort them by making a folder (001,002,003,etc) and move 50 files to every folder. [on hold]

I have several folders with a lot of pictures. I want to sort them making a folder every 50 pictures. For example if the folder has 1200 photos, make 24 folders, 001 to 025, and move 50 photos to ...
1
vote
1answer
12 views

save hdf5 data when admin kills script

I have a lot of Monte-Carlo data that I need to process at a particular cluster. What I do is, for a given data sample (which is on average of size 70 GB), I run some statistics script in python on ...
1
vote
1answer
40 views

Creating a new AD LDS instance without the Setup Wizard?

Is the installation of a new unique instance of AD LDS (using either cmd or PowerShell) possible? All resources I can find online just use the Active Directory Lightweight Directory Services Setup ...
0
votes
0answers
39 views

Run none Linux command in shell script

I am running the following code to telnet to a server via a shell script. #!/bin/sh (echo myusername; echo mypassword ; cat) | telnet -l myusername 127.0.0.1 After successful login, my shell changes ...
1
vote
0answers
22 views

Multi VPS: Best practice for semi-automated upgrades?

I've got many virtual private servers, each needing some apt-get upgrade -y lovin' from time to time. (Ubuntu 18.04) Problems I face: I don't have time to upgrade each one manually. I don't want to ...
0
votes
2answers
14 views

automate settings change on multiple power appliances

I'm trying to automate the task of changing settings on 100+ power appliances via SSH but each settings change has multiple interactive prompts. Is this possible or does anyone have an example of how ...
2
votes
1answer
24 views

Converting Microsoft Security Essentials DateTime in registery to readable format

I am trying to get some data from the Windows Registery using Windows Powershell (5.0+), specifically data of Microsoft Security Essentials. I managed to decode almost all of it and convert it to a ...
0
votes
1answer
34 views

How can I compute only current instance disks

I need some help with Google cloud. I need a shell script for creating a current instance snapshot. I have researched and found some shell script which can create snapshots for all project instances, ...
0
votes
0answers
28 views

Setting up a full mesh MACSEC among three Debian VM

I am trying to set up MACSEC connections among three Debian VM. I successfully established a MACSEC connections between any of them as a one-on-one connection, but when I try to set up another (...
1
vote
1answer
27 views

Changing PF rules on the fly to mitigate damage of DDoS (OpenBSD 6.4)

This is a two part question, really. Keep in mind that I am a developer not a system admin, but being the only employee in the company, I wear ALL the hats. I have deployed my server with two ...
1
vote
1answer
28 views

Script to count of unique users logged in to remote desktop server?

I am trying to create a web interface to allow us to monitor how many users are logged in to our 2008r2 terminal server farm. I have a script that is a good starting point and I have tweaked it for ...
0
votes
1answer
11 views

Get-Command Changing Drive

I wrote a powershell script that includes a check for the invoke-sqlcmd cmdlet. Script runs fine under Windows Server 2016. On 2012 R2, the script fails with: Add-Content : Cannot use interface... ...
0
votes
0answers
25 views

Get errors from Tomcat log in real time

I need to make a script to get certain errors from Tomcat log or maybe get them before Tomcat prints the erros to catalina.out. After getting error X, Y or Z, I want it to run a certain command, like ...
0
votes
1answer
19 views

Using credential name to map network folder that has identical form

We have a network share over vpn to a windows server in a different city. each person has a username to access the folder (and only that specific folder) his/her folder is same as username. user os is ...
1
vote
1answer
46 views

Crontab influences bash script if condition?

I am a bit baffled here, and not really sure how to debug this. I have a self-written bash script, that checks if a samba share is active, and if not, sends me an email. Script is in /root/SKRIPTS/, ...
0
votes
0answers
31 views

OpenVPN allow client_side script

By default the VPN client is asking the user to approve client-side script before it runs, I want to configure my VPN installer to allow user-level script execution on the client without the user ...
0
votes
1answer
38 views

Deploy MSI via GPO to specific users “Admin right issue”

I'm trying to deploy an MSI via GPO to specific users (120 users) from different departments and sites, the problem is that they don't have admin rights so the application cannot be installed due to ...
-1
votes
1answer
24 views

Command that returns exit code still returning 0 when using “command 2>&1 | tee -a /var/log/file.log”

I'm running a script that executes a command and save the output to a file in /var/log. After that, it gets the exit code and execute another command based on an if/else condition. The problem is: 2>&...
1
vote
0answers
27 views

Allow standard user to modify HKCU registry from script

I'm writing a batch script to launch a program for my Citrix environment and I'm running into some issues with a couple of reg keys I'm trying to set in the script. essentially I'm launching an ...
0
votes
1answer
65 views

How to execute 2 scripts on a server via ssh by chaining them and within only a single connection? [closed]

I have these 2 commands that I send to my server: - cat ./script1.sh var1 var2 | ssh my_user@my_server.com - cat ./script2.sh var3 var4 | ssh my_user@my_server.com This is a part of Gitlab CI, but ...
-2
votes
2answers
52 views

“kill -9 …” throws a warning when it's run from a script [closed]

In my script I have this: #!/bin/bash kill -9 $(ps aux | grep '[m]y_app' | awk '{print $2}') sleep 3 ENV_VAR=val123 nohup my_app & Why does it print this: kill: usage: kill [-s sigspec | -n ...
0
votes
0answers
219 views

Mapping Network Drive w/Credentials using Logon Script - Asks for Password

G'day - due to some changes in our network architecture, I've been having issues mapping our users to a network drive/folder located outside of our AD Domain - eg, it is still within our network but ...
-2
votes
3answers
62 views

SSH to server as one user, switch to root and create mysql dump - how to script this

I want to be able to copy a mysqdump from a remote server to my local machine. I had a script to do this, but our operations guys have now changed the server permissions and it doesn't work. So ...
0
votes
0answers
20 views

Python 3 Script delete old or unused IOS files

I am want to develop a Python 3 script that I can use to clean up old Cisco IOS image files (bin files). A major issue for me is there is more than one bin file. Secondly, I do not want to delete the ...
0
votes
2answers
405 views

Copy files to network drive with powershell script and task schedule

I have powershell script that is copying files from local drive to network mapped drive. Everything works fine when i run this script via powershell but when i run this script with task scheduler it ...
0
votes
0answers
61 views

How to use “sudo” for installing an app on gitlab.com for CI?

I have a project at gitlab. I'm setting up Continious Integration for it. I need to install sphinx search engine and it requires sudo. - http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64....
-1
votes
1answer
70 views

Run commands in fish from bash script?

I have a rather long bash script for setting up a server cluster. I'd like to start switching over to fish interpreter but I'd like to do it in steps. Can I keep my bash script as is and add the fish ...
3
votes
1answer
104 views

Do group policy shutdown scripts run before Windows Services shut down?

You can have a [shutdown] section in group policy which specifies some scripts to run during system shutdown. Do all these scripts run before Windows services start receiving 'Preshutdown' ...
0
votes
0answers
66 views

powershell - get from ad group user name and they group

in my AD I have security group "Citrix" and in this group I have added a lot of groups "Citrix 1", "Citrix 2", and more... in this group has add users. I need to get information with powershell users ...
0
votes
0answers
15 views

INotify: Treatment of bulk moves vs. individual files

Our environment is making use of inotify events for the purpose of triggering file transfers, but with our lab being a closed environment it is difficult to replicate inbound streaming file writes. ...
0
votes
1answer
35 views

List all Linux servers where my account was created

I'm a new Linux sys. admin (in the past, Windows sysadmin) We have 400 and more Linux servers. On some servers my account is create and on some not. I want to know wich server I have to ask for ...
0
votes
1answer
34 views

debian cron.hourly script not executing

New to cron on debian 9 , I have a file called ipupdate in /etc/cron.hourly/ipupdate -rwxr-xr-x 1 root root 132 Jul 11 18:21 ipupdate the file has a single curl command like this: curl "https://..."...
0
votes
2answers
551 views

CentOS 7 custom service failure (Interactive authentication required)

I am trying to setup an OFBiz fork called Scipio as a service on CentOS 7. The service wrapper script changes the user to a dedicated one for the program. All of the program's files are owned and in ...
1
vote
0answers
99 views

Set Windows 10 Default Start Layout

How can we set the default start layout and task bar icons for each user in Windows 10, yet still let users modify them later? I know you can use an XML file to set these, but a standard XML file ...
0
votes
1answer
1k views

how to open sftp connection and execute sftp commands in shell script?

I need to connect to multiple SFTP connections and copy files to my system. I will maintain one CSV file in our local system. It will have multiple partners' information of username, password, ...
0
votes
1answer
130 views

Powershell - piping in related variables from a list

I am trying to export formatted folder ACL permission list for a limited set of folders on a file server. I have a list of folders to read out permissions from and a list of file names that I want to ...
3
votes
2answers
118 views

How to run a script on a server 1 minute after a commit has been made?

Apart from creating a 2nd script which would check the time of the last commit and then run the main script and which would be too complex of a solution, is there a simpler one?
1
vote
0answers
43 views

ideas needed - cut the smb connection when disk full

Hello sometimes we are having issues like when some misbehaving user copies files to a server via admin share or other share and he causes disk drive to fill and a p1 ticket be created by monitoring. ...
0
votes
0answers
36 views

debian 9 script to add sudo user

I was trying to make a script to set up a sudo user . Copy pasting one by one Debian commands work , but not running in script . Debian9=$(lsb_release -a 2>/dev/null | grep '^Description' | awk '{...
0
votes
0answers
37 views

What are the Non-GPO settings like Fine-Grain Policy settings that affect AD objects in Windows AD environment

I would like to know the list of possible settings available in Windows AD environment (irrespective of version) that are Non-GPO settings which could be used to modify the configuration of an AD ...
-1
votes
3answers
913 views

Bash script: save last line output from terminal

I am writing a bash script in which I would like to save the output of the last command in to a variable before running my next one so I can display it later. I have tried a few different methods ...
2
votes
1answer
103 views

fdisk with a a single command fail in the second execution

I ran a script to format a disk with fdisk like this: (echo n; echo p; echo $number_part; echo $firs_sector; echo $second_sector; echo t; echo $format; echo p; echo w) | fdisk /dev/$disk when i ...
1
vote
0answers
120 views

remote powershell unrecognized command when calling functions

I have two servers. Server A needs to contact server B and run a specific function withing a powershell function library (just a .ps1 file) that I've created. The function that is being called also ...
0
votes
0answers
27 views

Making post alert script for snort

I`m trying to make a script that trigger an action if 5 snort rules ware broken in 24 hours interval. I`m putting all my snort logs in alert.log Can some one help me to make a script that motor this ...
0
votes
1answer
91 views

Appending deployment.properties to enable TLS

I need to be able to append everyone's deployment.properties file to add additional lines to enable all versions of TLS. Big enterprise uses multiple different versions of Java and also multiple ...
-2
votes
2answers
63 views

Check existence of multiple network shared files

Let's say I have a list of files (files.txt), which looks like: \\myshare\file1 \\myshare\file2 \\myshare\file3 How is it possible to check via a batch script (windows) to check if those files exist ...
0
votes
1answer
2k views

Appending to an array within a ForEach-Object loop

I've run into a strange problem when attempting to append to an array from within a ForEach-Object loop that is traversing another array. I have attempted to recreate the problem as concisely as I ...
1
vote
0answers
189 views

Set-Acl : Attempted to perform an unauthorized operation while using Addaudit Rule

I am trying to run Powershell script to set Audit Rule on C:\Windows\security folder on my Windows 2008 box. Below is the script: $FileDirList = ("C:\Windows\security") $AccountName = New-Object ...
1
vote
0answers
75 views

automate server downtime for different servers at different days and time

I have created script with Ansible and also with Python to put servers down in my work environment but If I can create group of all servers and set their downtime at once. Example: If I need to put ...