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
0answers
236 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
50 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 ...
0
votes
1answer
242 views

rsync: change_dir “/home/Sources//account@sub.inmotionhosting.com/home/account” failed: No such file or directory (2)

When run this command to make backup database file from remote server, I face the below reasult but I do not know what is the issue. The command I run on my local ubuntu server to git file from ...
0
votes
0answers
51 views

Mikrotik block lists rules

Can some one help me with one solution with my Mikrotik? I've block a brute force attackers (for RDP port), putting them in a list 1 (for example RDP_BF_LIST_10_Days), using firewall rules. They are ...
1
vote
3answers
108 views

Delete Local Administrator

Back story real quick: some reason some servers have 2 local admin account... no idea, I took over the job and cleaning everything up. I need to go through 600-ish (or more) servers to delete the ...
0
votes
1answer
2k views

Assign group permissions on folders using Powershell via CSV

we are working on a new Permission Concept. We created different Security Groups,depending on the Department. For example: Finance_List, Finance_Read, Finance_ReadWrite Controlling_List, ...
0
votes
0answers
282 views

how to remotely execute powershell command to get WWN number of multple windows hosts and need powershell script

how to remotely execute powershell command to get WWN number of multple windows hosts and need powershell script Get-InitiatorPort | Select-Object -Property PortAddress | Format-Table -AutoSize ...
0
votes
0answers
8 views

Setup aliases and functions in powershell without enabling scripts on the system?

I have a couple small functions which I would like to have available for my profile when I use PowerShell ( PSVersion 5.1 ). But I do not want to enable running scripts on the system. Hence is there ...
1
vote
0answers
21 views

ActiveMQ automatic Configuration file change and Re-Deployment

How can we automate the task of a configuration file change for ActiveMQ? Situation: We are running a T.A.P. street of ActiveMQ servers (5.15.7), the A and P environments are in a SAN Master Slave ...
0
votes
1answer
137 views

Storing Xenserver VM Snapshot UUID as a variable in a shell script to create .xva files from snapshots

I was looking at this question which was asking something sort of similar for help and is the closest thing I could find to helping, but it doesn't solve my issue: export XenServer snapshot as file ...
0
votes
2answers
116 views

Arping does not work in a script

In my network I have one linux host as a default gateway located at 192.168.150.1. On another host at 192.168.150.4 I have this script to measure time between sending an arp request and receiving it: ...
-1
votes
1answer
877 views

For Loop in cmd and powershell - 1 is unexpected at this time

I need to run a for loop, from powershell, in cmd... aka, at the PS Prompt: cmd /c For /L %i in (1,1,5) DO (Echo %i) But, I get a "1 is unexpected at this time" Other responses in my research ...
0
votes
0answers
33 views

File permission issue with setuid bit set

I have a script on a server that has permission ---s--x--- but when i try to access/run it, I get a permission denied. The user I try with doesn't own the file nor is the member of the group that owns ...
0
votes
2answers
91 views

Writing a bash script not getting the expected output

This is the bash script I am writing. You can see the expected output. But I am getting something else. Where could I be making a mistake? #!/bin/bash #Demostrate how read actually works echo ...
0
votes
0answers
11 views

Initiate Windows 10 User Profile Without User Credentials

After I imaged new computers I have to restore their data which is a copy from their C:\Users\USERNAME folder. I created a Python script that copies their folder, but I would like to restore this ...
0
votes
1answer
646 views

Powershell test script returns error “The term '=' is not recognized as the name of a cmdlet, function, script file, or operable program”

powershell users! If I run powershell as shell and type commands one by one - weverything's good. But if I put commands into .ps1 file and try to execte it I receive weird error: The term '=' is not ...
1
vote
0answers
75 views

Automatic DB creation with MongoDB in Kubernetes or OpenShift

I have a MongoDB cluster in Kubernetes, it's pushed to Kube with a StatefulSet type of deployment. That part work's good, I can even create 1 DB with variables starting with that... My question is, ...
1
vote
0answers
41 views

Double bracket missing in Oracle Linux

So I was trying to write a script in an Oracle Linux server and nothing worked. To begin with, there is no double bracket as far as I can tell. Also, the error messages I get are weird. For instance, ...
0
votes
1answer
79 views

Count down date time shell script [closed]

i have 3 parameters of date "Sep 30 Mon" (Month,DayNumber,Day), and i want to make a shell script that shows the quantity of days left to reach to Sep 30 Mon. How can i do it?
0
votes
1answer
88 views

Batch Script for service restart and alerting over email

Please let me know what i am doing wrong in my code. I am trying to check a set of Services starting with specific set of name. And triggering an email if service is in stop state. I have made a loop ...
0
votes
1answer
60 views

Script to check exe files version

I would like to know the version of all exe files in D: Drive (right click the exe, details tab, "Product version" field) I have done a script which include sigcheck.exe from Sysinternals Suite; it ...
1
vote
1answer
70 views

Enter at the end of a specific line

I have the following file.txt that follows the same pattern and I want to modify it where this file is by adding an ip: # gfhfhgfh gfhfghgfhgfhgfh MACs # access USER CONSOLA *,!10.249.247.3,!10.249....
2
votes
1answer
227 views

Powershell, how to compare user input

I'm making a "shortcut" PS1 script to update a domain user's password. I'd like to prompt the user for the new password twice without showing the password on screen. When I use $Text1=Read-Host ; $...
0
votes
1answer
744 views

How to prevent empty subelement list error in Ansible loop?

When I try to loop (with Ansible 2.6 loop) with subelements through all public keys of a list of users and encounter a user which has no public keys defined: - authorized_key: user: "{{ item.0....
1
vote
1answer
119 views

How do I get Postfix to run a script every time there is a outgoing delivery error?

I would like postfix to run a external php script (a hook) every time there is a outgoing delivery error. For example, my webserver sends out emails and sometimes the recipients mailbox is full or ...
0
votes
1answer
91 views

Expect Scripting: Is there a way to default back to a previous spawn_id?

After I scp a file using spawn, the spawn_id, exp8, closes out. gets eof. so, any other commands I run after that, I get this message: an not find channel named "exp8". So I'm assuming that once a ...
-1
votes
1answer
81 views

Script on Linux only gives me “no such file or directory” [closed]

I've come across a problem, I am writing a script that would find the biggest file in directory and sub-directories, then show full path on screen. Can't seem to get it working. The error I'm getting ...
1
vote
1answer
34 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
955 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 ...
1
vote
0answers
33 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
19 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
107 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
40 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, ...
2
votes
1answer
225 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
385 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
26 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
39 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
484 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
177 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
1answer
529 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
187 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
496 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
69 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
64 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 ...
-2
votes
3answers
181 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
2answers
3k 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 ...
-1
votes
1answer
602 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 ...
4
votes
1answer
345 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
1answer
37 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 ...