Questions tagged [scripting]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

exec 2>&1 – execlude some command from being logged to file

I have the following in my bash script: # catch input for log-data exec > >(tee -i ${LOG}) exec 2>&1 I want to exclude one command from being written to this log file, but the following ...
0
votes
0answers
9 views

Failed to satisfy all dependencies (broken cache)

fatal: [ip]: FAILED! => {"changed": false, "msg": "Failed to satisfy all dependencies (broken cache)"} I am trying enter image description hereto run ansible script ...
1
vote
2answers
19 views

Bash-script: run another script on bottom as an other user

I have a bash script that runs over crontab as root. On the bottom of that script I want to run another bash script as another user in a subshell (detached). How can I do that The normal command would ...
0
votes
1answer
23 views

Simple bash syntax failing passwd

Whenever I try to enter the password for a new user through pipe it doesn't work for me.. this is the command: echo "${PASSWORD}" | passwd ${USER_NAME} However it fails to work, what am I ...
-2
votes
1answer
14 views

Passing a list as parameter in a call within a windows bat file

For a set of project, I need to automate granting access to users and would write a *.bat I would write something like this (but more complex): @echo off CALL :grant "user1 user2" "read ...
0
votes
1answer
30 views

Script without put ran as administrator leaves no file [closed]

I am trying to run this script as administrator. When I run it without admin rights the log file is save in C:\Windows\System32. I put echo %~dp0 in the script and it echos to the current directory. %~...
0
votes
2answers
117 views

8: Syntax error: word unexpected (expecting “)”)

The following code: weekday=$(date +%a) day=$(date +%d) month=$(date +%m) if [[ ( $month == 03 || $month == 10 ) && $weekday = "Sun" && $day > 24 ]] then # ...
0
votes
1answer
40 views

Any PowerShell Script to Backup and restore Ms-sql database using dB username and password?

I am looking for a PowerShell script which can take backup and restore MS-SQL databases using SQL authentication.
1
vote
1answer
49 views

Recursive PowerShell script to protect all OUs and Objects from Accidental Deletion

I'm sure there has got to be an easier way that what I hand-jammed.... I'm trying to write and run a PowerShell script that will set the ProtectFromAccidentalDeletion flag to "true" ...
0
votes
0answers
17 views

Automating kill Terminal sessions older than 24h script on Windows with PSKILL?

So currently, when a user forgot to close his session accordingly we need to manually go to our terminal server, search all active session with qwinsta /server:localhost and kill the unused sessions ...
0
votes
0answers
18 views

Output to log file from Script not working

I have an interactive script example.sh for updates, part of which is something like this: echo "Performing Backup of Old software" zip -r backup/backup-$now.zip /var/www/html/...
-1
votes
1answer
56 views

What is the Script CMD for add rule for Routing and Remote Access in Firewall?

Does anyone know the script from Command Prompt to add a rule for Routing and Remote Access ? Routing and Remote Access (GRE-Out) Routing and Remote Access (L2TP-Out) Routing and Remote Access (PPTP-...
-1
votes
2answers
43 views

SCP exit 0 when using un-initialized variable and fail to copy

I am trying to test if a file fails to transfer using SCP. I noticed if I use a un-initialized variable, I get exit 0 even though the SCP fails. For example, I have an empty variable called ...
0
votes
0answers
9 views

Group Policy to copy users profiles to the server

This is my first time asking here but, I tried to find a solution but nothing so far, I want to create a GPO that will automatically copy the user's profiles of all computers for a folder in the ...
2
votes
1answer
32 views

Does MS Teams write to Event log?

I'd like to trigger a script action upon MS Teams client launch. My first guess was to hook it on an event in the Event log. However, I was unable to find if the app actually writes to the Windows ...
0
votes
0answers
17 views

copying latest version of a file to another location

a directory /tar/opts/sw/log contains several versions of the same file..eg.log_aaa_0001,log_aaa_0002 ,log_bbb_0001,log_bbb_0002,log_bbb_0003 etc where log_aaa_0002 and log_bbb_0003 are the latest ...
0
votes
1answer
50 views

Renaming a tar file in unix script

cd /var/opt/sw/e4/data/dev/e4_dev/DEVL3/EW/EWD1/DATA/AED/INPUT for file in *;do tar -czf ../OUTPUT/"${file}".tar; done According to the above code the files in input path eg. aedlog, aaalog....
0
votes
0answers
28 views

Script to search for specific task in scheduler and delete this task

I am quite new in this area and I am bit lost but when I have looked to: https://serverfault.com/questions/604673/how-to-print-out-information-about-task-scheduler-in-powershell-script ,this was ...
0
votes
0answers
300 views

How in Ansible AWX 15.0.1 to use 'in' to find a nested variable from extra_vars

I wrote in my extra_vars block in AWX the following variables that I expect to be changed anytime someone runs this servers: - vm_name: TestDeploy01 vm_ip: 10.10.1.241 vm_tag: - Infra ...
0
votes
0answers
37 views

When setting up openvpn in NetworkManager GUI (KDE Plasma applet) how to make it respect the .conf/.ovpn file configuration?

I have my .conf files for openvpn working fine in an Arch with KDE Plasma. My conf files have some lines to update the DNS configurations like below: script-security 2 up /etc/openvpn/update-resolv-...
0
votes
1answer
140 views

multipart/mixed content type and boundary refused by Amavis

I'm writing a Ruby script that send SMTP email. The email is divided onto 3 parts: headers, body and attachment. Unfortunatly, I'm struggling to satisfy an Amavis requirement: properly writing the ...
1
vote
1answer
107 views

In Debian-based script: how to determine if kernel changed and needs reboot?

How can we (more) easily determine if a kernel-change-reboot is required in Debian, other than doing this in a script (which is a bit cumbersome)? Ubuntu has /var/run/reboot-required and per our ...
0
votes
0answers
407 views

PowerShell Script to create a VPN connection for all users

I have the following PowerShell script that creates a VPN connection and a desktop shortcut to Rasphone. # # Powershell script to create a client VPN connection to a Meraki MX. # # Configuration ...
0
votes
1answer
20 views

Installing the Scripting Extension Python - SNAPSHOT JARs

I am trying to install the Geoserver Scripting Extension - Python (description). After downloading geoserver-2.17-SNAPSHOT-python-plugin (my Geoserver is 2.17.0) I followed the instructions: Extract ...
0
votes
1answer
67 views

Systemd python script won't log (buffer cause)?

Although the problem exposed here seems very similar, none of the solutions provided work. Context : Raspberry Pi Zero W, Raspbian Lite (2020-08-20) I want to register a python3 script as a service, ...
0
votes
0answers
38 views

Terraform Windows Server on AWS - Script not executing?

I have deployed a Windows Server (2019) via Terraform onto AWS. It seems as though my script lines are not being entered when I deploy the server. It deploys the server, but nodejs does not seem to ...
-2
votes
2answers
137 views

Linux Bash Scripting using grep sed and cut command to display ip address with port number

Can any one please help me I need a output of "192.168.1.1#53" by using these 'grep' 'sed' and 'cut' command mandatory in linux bash scipting in given below text. ;; Query time: 29 msec ;; ...
0
votes
0answers
299 views

Correct way to run scripts in automated, unattended Windows installation

I have some custom scripts that I have written to customise Windows 10 such as removing bloatware and setting file explorer options via Registry Editor that I use to apply to all users and/or the ...
0
votes
0answers
24 views

Asterisk dialplan pattern generator

I was wondering if anyone knows about a shell script or Pyhton script, or whatever language, some kind of command line script that given a set of phone numbers, the script will then generate the ...
0
votes
1answer
64 views

make ssh remember host's username

I connect to many servers daily. my ssh config default username is "admin" but servers comes from different environnements and username can changes. sometimes it will be "ec2-user" ...
0
votes
1answer
1k views

PowerShell: How to check a recurrent week time interval?

I need to create a PowerShell script, able to collect some data at each minute. However, this script cannot run during the "technical windows", that are scheduled to occur at the same week ...
1
vote
0answers
22 views

Capturing output of remote process from sysinternal's psexec Script

I'm trying to deploy a program throught PSexec with a script from Bat file to use one CMD instance per computer and not one after the other. I need a log to be generated on my local server to be sure ...
0
votes
2answers
174 views

Bash script with output

I have a server that needs to send daily some files to remote machines. I have done this script in order to automate this task. What I need to insert on this script in order to see if this task as ...
-1
votes
1answer
46 views

How to rename multiple files by adding word from that file?

I have files : file name: report_2020-10-13-17-11.txt Contain : ... this report was prepared by=John ... file name: report_2020-10-13-17-12.txt Contain : ... this report was prepared by=Doe ... ...
1
vote
1answer
140 views

fail2ban txt list creation of banned IP

using fail2ban for years, working nice, would like to automate and harden the security for my router. So I would like that fail2ban created a local file, example, list.txt file with a list of banned ...
0
votes
0answers
88 views

sequence of w3m commands into script for automation

i have a specific command sequence in w3m. Now i want to put these commands in a bash script. Does anyone know how the syntax is for pressing "q", "tab", "enter" etc..? ...
0
votes
0answers
119 views

Powershell script to delete oldest files

I DO NOT want to "delete files older than X days." If I wanted to do this, I'd just pick one of the thousands of scripts out there that have already been written for that purpose, and I ...
0
votes
2answers
931 views

Invoke-RestMethod returns 400 error no matter what I do

So I'm working on a helpdesk automation with the Samanage API and need to update the "state" of the ticket. I've read the documentation and there is nothing i saw for updating the ticket ...
0
votes
1answer
52 views

Script executes perfectly in command line but failing in cron

I have created a script to know the successful attempts and failed attempts of users,usually everyday the /var/log/secure file goes to syslog and zipped like "secure-20200910.gz" but without ...
0
votes
1answer
41 views

Multiple same user creation with same username on multiple server

Below is the script which i use to create single user on server(I use another scpect script to copy below script on server and run script),But i want to create multiple user. So,only once i will enter ...
-4
votes
1answer
130 views

How to add credentials to bitlocker script

I'm trying to create a script to see if the bitlocker works or not. If it works, then a file is posted in the c:\ folder We will call "yes" if the bitlocker does not work then add password ...
0
votes
1answer
122 views

Crontab - Sending StdErr to email and stdOut to log file

In my crontab, I'm trying to send stdout to log file and stderr to email account using a custom subject title. I've tried many solutions without achieving my initial goal, let me explain: First method:...
1
vote
1answer
300 views

Run local bash script on multiple remote machine

I have below bash script,every time i want to create a user i need to copy this script to server and run it. Is there any thing we can do so that this script fetches the IP's from a hosts.txt file(...
2
votes
2answers
62 views

Cronjob can not execute smartctl?

I have a cronjob installed (Ubuntu 16) that runs with the root user. So in sudo crontab -e I have the following entry: 10 5 * * mon /home/userA/raidchecker.sh And the script raidchecker.sh does this: #...
0
votes
2answers
2k views

PowerShell script to report free disk space on servers

I am required to get reports about free disk space on our exchange servers. I found this link : https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Script-Sample-f7164554 But I am unable to ...
0
votes
0answers
42 views

lftp sync FXP script

since I have two ftp servers, I would like to make sure that the first server (ftp1) automatically synchronizes with the (ftp2) the files. I have read that it is possible to do this with lftp via the ...
0
votes
1answer
51 views

Trim and allign an output of command in expect script

{ echo ' ' ;echo ' IP : ' ;ip route get 8.8.8.8 | cut -d' ' -f7,8 | tr -d 'src' ;echo ' ' ;dmidecode -t bios | grep -iw 'Version' ;echo ' ' ;} the output of above command mentioned is: IP : 10.0.0.1 ...
0
votes
1answer
136 views

how to use ping in expect script

Need assistance while i want to ping server if got reply then proceed with script and if no reply go again to previous step where we fetch IP from hosts.txt #Setting up Variables set timeout 5 ...
0
votes
0answers
24 views

Summarize first column same field

I have some datas with URL's and used network data. I made a custom file with these data's and i stuck last one step. What i have now: sevroland.api.url.com 488 www.logstach.url.com 42725 ...
1
vote
0answers
408 views

Retrieving the current PTP settings of an Ubuntu machine

I have an Ubuntu machine (18.04) with PTPd installed. I want to write a script that can determine what PTP settings have been set previously. Specifically, I want to find information on the master PTP ...

1
2 3 4 5
35