Questions tagged [scripting]

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

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

Scripting is usually done in a scripting language. Such scripting languages are often dynamically typed and interpreted, as opposed to compiled languages. Examples of such languages include PowerShell, Perl and Bash.

1826 questions
11
votes
6 answers

How can I run a script when my network connection changes?

I'd like to create a script to do various things when the network connection changes. For example, if the machine connects to my office network I might desire it to: mute itself change its DNS change its proxy settings change default printer Then,…
Michael Haren
  • 1,301
  • 7
  • 18
  • 31
11
votes
5 answers

Do Windows batch files have a %* construction?

In a batch file, do I have to do (e.g.) the following? @echo off call other.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
Roger Lipscombe
  • 2,177
  • 6
  • 24
  • 37
11
votes
5 answers

Can the Linux ps command output be filtered by user AND command?

I need the pid for a process given its owner and its command. I can filter a process per user with "ps -u xxx" and its command by "ps -C yyy", but when I try "ps -u xxx -C yyy", they are combined using OR logic. I need AND logic. How can I…
Krumelur
  • 275
  • 1
  • 2
  • 9
10
votes
1 answer

EC2 Startup - How to Tell When Windows Ready?

I am working with Amazon EC2, and I have some Windows AMIs backed with EBS. When I launch a new instance from an EBS snapshot, the EC2Config service prepares the Windows machine for me. I know when EC2Config is done because I can check the…
Dan
  • 103
  • 1
  • 4
10
votes
4 answers

How can I use openssl to get results from HTTP GET requests?

I need to use openssl to perform some HTTP GET requests in a shell script. The line I'm using to do this right now is shown below. This is parsing the content of an XML response of the following…
conorgriffin
  • 459
  • 1
  • 6
  • 25
10
votes
2 answers

Copy-item FileSystem provider error

Copy-item cmdlet is not working as expected, i don't understand why. This is my code : $Source = "C:\folder1" $Destination = "\\172.22.0.115\c$\folder2\" $Password = ConvertTo-SecureString -AsPlainText -Force -String "MyPassword" $User =…
10
votes
3 answers

Deploying Printers via GPO/GPP - is there a programmatic option?

For reasons beyond my control, I've been tasked with setting up GPO/GPPs to deploy our 100+ printers to our 1000+ clients. The good news is that we have over a dozen sites, and for the most part, I'm allowed to push out all printers at site X to all…
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
10
votes
2 answers

Changing physical path on IIS through appcmd isn't activated

We have come across an issue on IIS 7.5 where we have a simple deploy system which consists of the following: Create a zip-file of new webroot, consisting of three folders: Api Site Manager This is unzipped into a new folder (let's say we call it…
jishi
  • 868
  • 2
  • 11
  • 25
10
votes
5 answers

Bash snippet for killing a process until it's dead?

I'm trying to write a robust bash script, and in it I create a background process. At the end of the script, I want to kill it. I have it's PID. I was thinking of somthing like this while [[ ps ef $PID ]] ; do kill $PID sleep 0.5 done Any…
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
10
votes
1 answer

php5-fpm: bash script to check config before restart

I write a script to create new vhost on Nginx. That script creates Ningx vhost config file, vhost user and dirs, php-fpm pool file. At the end of the script, I would like to check if config is ok before restart php-fpm. For Apache, I do apachectl…
pvledoux
  • 261
  • 1
  • 2
  • 9
10
votes
2 answers

Bash script error: ./test: line 5: UID: readonly variable

I have a script that works okay on my dev server but when I try to run it in production doesn't work. I'm getting the following error which I can't figure out: ./test.sh: line 5: UID: readonly variable Any suggestions? #!/bin/sh while read…
hfranco
  • 585
  • 2
  • 9
  • 25
10
votes
4 answers

Install .msi from script, detect when install is done

I'm trying to make an install script. I want to install an .msi file, Python, and then install other things after Python is installed. I already see how to do a command-line install. However, msiexec returns right away, even when the install is…
Claudiu
  • 1,207
  • 5
  • 21
  • 28
9
votes
1 answer

Windows - turn off high contrast mode via GPO or script?

I have a situation with a sizable deployment of Windows 10 computers and users who are turning on some truly horrific high-contrast themes, and then consuming IT resources because they can't change it back. I'm aware that there's a keyboard shortcut…
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
9
votes
1 answer

How to get SCCM to recognize return codes from Powershell script completion?

I'm using an SCCM 2012 application deployment to install software. The specific install type is scripted installer as SCCM kept failing for exe validation errors. The script is powershell and successfully installs the software even when executed…
Colyn1337
  • 2,397
  • 2
  • 23
  • 40
9
votes
4 answers

Retrieve internet proxy server address via PowerShell

I have to retrieve the proxy server address and port via PowerShell, so I can use the Invoke-Webrequest -uri http://some-site.com -Proxy command. The expected output should looks like http://proxy-server.com:port. I there a PowerShell function to…
Ob1lan
  • 190
  • 2
  • 5
  • 15