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
1
vote
1answer
12 views

Get-VM command with -Location parameter returns one result then error

i'm writing a powerCLI script and i'm facing a strange behaviour. I use connect-VIserver with administrator@vsphere.local account to connect to my VCSA 6.7 U2 server. If i use Get-VM cmdlet without ...
-1
votes
1answer
15 views

How can I recursively unarchive all files that are bzipped2?

I have a folder. In this folder I have a lot of other folders. In folders I have bzip files and non-bzip. How to unarchieve all bzip2 files in same directory where they are ?
0
votes
1answer
34 views

.bat script that moves file to a folder and adds date

I've pieced together this script to try and move a file from a folder to another, and add a date to the end of the file. It worked once, but hasn't worked since. This is my first script, and I was ...
0
votes
0answers
18 views

Keepalived - Failover when both vrrp AND track script failed

I've made a track script which is ran at each check by keepalived. When the VRRP check is failing, the BACKUP node become MASTER, even if the track script is returning 0 status (good one). I just ...
0
votes
0answers
26 views

Interactively bypass/skip part of PowerShell script

I have a script that is made up of many steps. I want it to run from start to end most of the time. Sometimes, I want to skip one of the steps. I'm looking for a "continue by default unless user ...
0
votes
0answers
29 views

How store the result of the operation in each node

I used to SLURM My SLURM configuration is One Master Node , Two Compute Node I want to Store the result of the operation in each node. So I try to this Script #! /bin/bash #SBATCH -J testing #...
0
votes
0answers
39 views

PowerShell Script to remove Security Permission from Folders

Using PowerShell, I am looking for a little help to remove certain built in domain accounts from a folder under the users Home folder. I have already written code to remove inheritance, but I can't ...
0
votes
1answer
32 views

While schedule below script through crontab receive incorrect output date format is going wrong

PFB script dd=$(perl -e 'use POSIX;print strftime "%Y%m%d",localtime time-172800;') Date=$(perl -e 'use POSIX;print strftime "%d%m%Y",localtime time-172800;') for i in `cat /path/Path_CDR.txt` do cd ...
1
vote
1answer
60 views

Powershell Get-Netadapter varible pass to Set-DnsClientServerAddress

Good day everyone, Trying to write a simple script that will find the friendly name of the Ethernet Adapter on a given machine and pass this string to the cmdlet 'Set-DnsClientServerAddress' so that ...
0
votes
1answer
41 views

Removing empty List in output as result [closed]

I have a simple script as following: import re wanted_line = [] with open('lines.txt','rt') as myfile: for myline in myfile: wanted_line = re.findall('ticket/\d+',myline) print(wanted_line[:...
1
vote
2answers
132 views

Change Registry Key Permissions Access Control List using only Command Prompt

I am trying to change the Access Control permissions on a specific registry key i'm generating using a batch file. I try using regini.exe to pull the configuration from a .ini file and run into ...
2
votes
1answer
29 views

Faster way to add IP scopes to Item Level Targeting?

I have a GPO with printers mapped via the user preferences. Each printer needs to be item-level targeted only to computers in a specific IP range. I have a list of about 92 ranges that need to be ...
0
votes
1answer
26 views

Is running a script a process? [closed]

I run ./install.sh and I tried to background it to be able to close the ssh session. But after running bg the process is again outputting to the terminal. Also, I don't see anything with jobs. ...
2
votes
2answers
82 views

Net.HttpWebRequest difference between Powershell and PowerShell Core

Hoping someone can shed light on this. In Powershell, the following code generates output of the website certificate: $req = [Net.HttpWebRequest]::Create('https://www.google.com') $req.GetResponse() $...
0
votes
0answers
49 views

how to dynamicalle change the acl in haproxy?

haproxy.cfg frontend http-in mode http bind 206.189.22.155:80 acl path-page-designer path_beg -i $PATH use_backend page-designer-backend if path-page-designer ...
0
votes
0answers
11 views

Script for warming Varnish

I have a setup for ecommerce site with Nginx and Varnish. Although I have a cache warmer in my php application I need a script in server level which will load a txt file for hitting with curl some ...
0
votes
0answers
36 views

Running a script on all servers behind a loadbalancer in aws

I've a task in hand where I've to run a script on all the servers behind a load balancer in aws. We have auto-scaling as well so at the time of high load, new servers get added behind the same load ...
0
votes
1answer
105 views

Script to storage vmotion from one datastore to another

Ive done some searching and could not find what I'm looking for so I am making a post: I would like to storage vMotion from one datastore to another, 10 at a time, and output the vm's migrated to a ...
1
vote
0answers
33 views

How to configure a https proxy with JVM command line arguments?

I am trying to create a container with Docker that contains eclipse and some plugins. By now, I am trying to configure the proxy that I need for internet connexion and it works for the http but not ...
0
votes
1answer
22 views

Perl - SSH and run backup while retain the session

Hope someone can help me here. Looking to redo my bash ssh script for cisco devices, and add on to it. Basically, my idea is to have an SSH to log me to the device in enable mode (so i can do regular ...
0
votes
0answers
14 views

Change Internal Microphone properties via script

I have been asked to write a script (or GPO) to push the following to a good amount of clients... However I have been unable to find a way to accomplish this, all I find is how to change volume, ...
0
votes
0answers
79 views

Cannot shut down WildFly 9.0.2 with CLI

I'm trying to shut down WildFly 9.0.2 with a script (Windows Server). Everything I have read online point to the same command: jboss-cli.bat --controller=localhost:9990 --connect --command=:shutdown ...
0
votes
0answers
44 views

PowerShell function parameter becomes null inside try block

I'm putting together a powershell zip in transit script that would be called via a function, but it keeps saying the path is null after it creates the zip file. After running the script in ISE I then ...
0
votes
0answers
17 views

Schedule access to windows network share (grant, revoke permissions on certain date for certain user)

We are looking at automating the task of granting and revoking Windows network share permissions to certain users (apprentices) that move through different departments in the company. Each time they ...
0
votes
0answers
43 views

cron job not working in unix but works when executed manually [duplicate]

I am running a cron job everyday at 21:00 UTC which downloads few csv files from sftp server, renames the downloaded files and then loads the files in database(mysql) and updates the time in database (...
0
votes
0answers
109 views

TMUX not creating sessions from CRONTAB

I'm having a heck of a time getting a tmux session to be created from a script executed by crontab. The script executes and the session is created without fail from just running it but if I run it ...
2
votes
1answer
38 views

How to script GPPs?

I'm trying to normalize Item-Level Targeting for several GPPs that I've created. Manually slogging through each one via the GUI is just about the last thing I want to do. The terms tedious and error-...
0
votes
1answer
77 views

run script remotely on windows 2012 server

I have a script that I manually have to run 4 or 5 times a day, in one of our servers. I remotely access the server and execute the script. The OS is Windows Server 2012 R2 Foundation. Now, I can´t ...
0
votes
2answers
96 views

Cron Script running multiple times [duplicate]

We have a script that is used to sync some directories to a USB disk drive. It is set to run once a day but often takes longer than that. To ensure that multiple copies of the script don't run at ...
1
vote
0answers
87 views

MD5 hash comparison over SMB SLOW

I'm scripting a full backup solution in powershell on Windows server 2016 for Hyper-V VM's and have run into the issue that calculating the MD5 hash over the network on a mounted network drive across ...
2
votes
1answer
56 views

Batch script with %date% variable

I do robocopy using .bat script, this script is starting 22PM before midnight and it took over 5 hours to complete. The problem is that destination folder is created with date \nas01\%date% so when it ...
0
votes
0answers
36 views

Using powershell to track process spawned by .bat file

I have a third party application that uses .bat batch files to kick off their java applications. (It's pentaho, but not sure that matters much for what I'm doing). I'd like to be able to get a hold ...
1
vote
1answer
71 views

How to lock / unlock a gpg hardware token via script

I would like to execute gpg --card-edit; verify; quit non-interactively to unlock a gpg hardware token (i.e. smartcard or yubikey). My usecase is: Enter a password e.g. via ssh Store it in the ...
0
votes
1answer
76 views

Script to automate data population once windows VM in GCP started

I need to know if there is any way I can build a script which can be executed as soon as my windows VM is started in GCP. This script should(Other than RPA solution) be able to open a web browser and ...
0
votes
2answers
43 views

Basic Powershell script strange behaviour

I have small script. Which i want test it with "If, else statement". I have the same value variables but when try to compare it, it gives else condition, but it should give true condition. Below are ...
1
vote
2answers
23 views

ssh remote won't run if

This won't run, ssh -o ConnectTimeout=10 -o BatchMode=yes -o "StrictHostKeyChecking no" -q server1 "if [[ $(/usr/bin/lsblk /dev/sde | wc -l) = 2 ]]; then echo found; fi" But if I do it on the ...
0
votes
0answers
22 views

hardening-check on all sub-folders

how would I go to automate "hardening-check" on an entire OS? I can do it manually with /example/* but if there is a folder in /example/ it will just skip it. I haven't found a way to do the check on /...
0
votes
1answer
146 views

Send rpm to multiple systems, remotely execute rpm install and repeat

Fairly long time reader, first time poster. I am not a scripter (yet) but I understand/know some basics. Not all the basics, but some. I've been doing lots of searching but have not found my ...
1
vote
0answers
42 views

How nginx to update reverse proxy its conf dynamically?

I am planning to set a reverse proxy with nginx , my question is i want to dynamically change the reverse proxy in nginx depends on the request is coming Let us say i have request xyz request from ...
1
vote
2answers
202 views

Modify new user home directory permissions with powershell

I am needing assistance with a script. What I am trying to accomplish is when new users are created in ADUC and their profile path(home folder) is created, it gives the users "Full Control". I am ...
1
vote
2answers
88 views

Ensuring network drives are mounted before performing a backup [duplicate]

I'm trying to write a backup script that can be deployed on many different linux servers, some of which mount network drives as described in /etc/fstab. I want my script to be able to see if any ...
0
votes
1answer
36 views

Create a list of user whose home directories have no files newer than 7 years

I have an old storage with hundreds of user home directories. I want to reclaim some disk space by deleting all "old" home dirs. It's on a linux server, RHEL 6. I want to delete the entire home dir., ...
0
votes
1answer
133 views

Windows 2012 server, created task not running

Created a task o windows 2012 Server, to run a *.bat file. Set up to run at startup and repeat task every 15 minutes. @ECHO OFF REM -------------------------------------------------------------------...
0
votes
1answer
170 views

Connecting to an l2tp VPN via script doesnt always use the same network interface

I have a linux web server and I need to create an on-demand l2tp ipsec VPN connection with a network route. The VPN connection works and the route is automatically created via a script in /etc/ppp/ip-...
0
votes
0answers
22 views

identify a file with specific chars and rename

I am trying to find and rename below files using below script IYBR2C.YGPSWS.SL.1.M.20190503170641.csv to SAK_BB_AL.csv QWEJ1P.YGPSWS.SL.1.M.20190508122932.csv to SAM_SG_MO.csv SCPR1C.YGPSWS.SL.1.T....
0
votes
0answers
186 views

Task Scheduler To Run batch file windows server 2012

Hi I have been struggling with this for a while and I don't know what the problem is. I need to Deploy software to 100 computer on the domain. My domain has windows server 2012. I created a Group ...
1
vote
1answer
83 views

Rsync include-from, exclude-from without source directory

I am working on a backup script but got some problems with my script, can you help me? INCLUDE="/data/scripts/include.txt" EXCLUDE="/data/scripts/exclude.txt" DST="/backupdir" rsync \ --...
0
votes
0answers
221 views

convert Curl request to Powershell request using Invoke-RestMethod

I am trying to get help on converting my curl request to powershell code. what I am not getting is how to pass the parameter to url in invoke-restmethod call. My curl request: curl --compressed -k -...
-1
votes
1answer
49 views

Process monitor script bash, how to add below wait time, interval and logs capability [closed]

I am using below script to monitor some processes on linux and restart if process is down and send email. I want to add below improvements in this script, I need help in that case. Can anyone help ...
-2
votes
1answer
35 views

How to output one number few times with spaces in one line via bash [closed]

How to output one number few times with spaces in one line via bash I have a=5 b=10 I should output 5 times number 10 with using of variables and with spaces Also, i should capture this in variable ...