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

learn more… | top users | synonyms (2)

3
votes
1answer
162 views

echo $? doesn't work when executed remotely

When I execute a command as below it gives me an output as expected but when I run the same command on remote server it always gives me echo $? as 0. locally # <some command> # echo $? ...
3
votes
3answers
147 views

Direction for Scripting

I'm administering a network and they use a few scripts here. Mostly batch scripts or vbscript. It's a Windows environment, mostly Server 2008 with a few 2003 servers. My question is Should I learn ...
3
votes
2answers
8k views

Delete registry key via CMD script?

I'm want to edit an already production .cmd script file, to have the script delete a certain registry key in the Windows registry. Firstly, is this even possible, and secondly (if that's not ...
3
votes
3answers
7k views

How to use a config file (ini, conf,…) with a Powershell Script ? Is it possible?

Is it possible to use a configuration file with a PowerShell script ? for example, the configuration file: #links link1=http://www.google.com link2=http://www.apple.com ...
3
votes
4answers
1k views

Change all network cards to auto/auto on many machines

Because of a change in networking equipment I might need to set a bunch of machines NICs back to auto negotiate. What's the best way to automate this? I'm thinking an Autoit compiled exe pushed out ...
3
votes
3answers
221 views

simple nagios script failing

What is wrong with the following if-then-else? I never can hit the else. if [ $result > $value ]; then echo HEALTH: OK. Result is $result Value is $value exit 0 else echo HEALTH: ...
3
votes
4answers
775 views

How can I search IIS logs of several servers at the same time?

I need to search the logs of all the servers in the array for a particular string. Specifically, I need to determine if a given user is using OWA, EWS, or something else with our CAS servers. Is ...
3
votes
1answer
851 views

How to Load commands into your powershell profile to run on starting powershell

I have found a way to load exchange 2010 powershell into powershell running on a windows xp workstation, however there are a few commands that need to run. I was wondering how I could load them into a ...
3
votes
2answers
2k views

Evaluating expressions in windows batch script

This one could turn out as the dumbest question ever, as I am probably missing out the obvious. Anyway, here it is: Can you evaluate expressions in a batch script. For example, I want to add two ...
3
votes
7answers
1k views

Automating Administration Tasks on Windows

What tools do you use and recommend for automating administration tasks for Windows-based computers? Examples of such tasks include: Installing/upgrading software Standarizing application settings ...
3
votes
2answers
125 views

Discrepancy in ssh-agent behavior

It seems like i'm having a bit of a discrepancy between the behavior of ssh-agent for two accounts I have configured. I wrote a simple monitoring script to check on the availability of some VMs we ...
3
votes
2answers
672 views

How can I check for a string match AND an empty file in the same if/then bash script statement?

I'm writing a simple bash script to do the following: 1) Check two files (foo1 and foo2). 2) If foo1 is different from foo2 and foo1 NOT blank, send an email. 3) If foo1 is the same as foo2... ...
3
votes
4answers
754 views

Lightweight script for monitoring disk space, ports, etc.?

If I want to monitor some machines that I'm not the primary maintainer of (ie, I don't have access to install packages), are there any lightweight alternatives to things like Nagios? I'm looking for a ...
3
votes
3answers
1k views

how to rename a remote file on linux with script

I would like to have a (bash) script to rename a file on multiple remote linux servers any idea how to do it? thanks.
3
votes
3answers
4k views

scp files and delete files on remote directory [closed]

I am a unix noob, so please be patient :-) I have a script that scps a bunch of files to another server. Suppose they are z1.foo, z2.foo etc. What I want to do is to overwrite the files at the ...
3
votes
3answers
4k views

bash script with permanent ssh connection

I use a bash script which runs /usr/bin/ssh -f -N -T -L8888:127.0.0.1:3306 serveradmin@34.324.234.23 However, when I run the bash script, it waits.. I see the connection coming up but the script ...
3
votes
4answers
3k views

Need a way to run a script on windows boot up prior to a user logging in

I need to run a custom script which runs when Windows boots up.I know its possible to run it when a user logs in but I want to run it when the system reboots i.e. prior to a user logging in. The OS in ...
3
votes
3answers
562 views

Write shell script that can only be run by a sudo user in Ubuntu

I'm writing a shell script that is supposed to be run by users only in sudo user list, what's the appropriate way of doing this? what I'm thinking is in the shell script, try to create a dummy file ...
3
votes
1answer
936 views

How can I start multiple programs simultaneously?

I have 4 programs that I'd like to start by using only 1 script or shortcut. How can I achieve this? Is Powershell able to do that? I tried to do it using a .bat file but the script pauses until the ...
3
votes
1answer
167 views

“Threading” in Shell Scripts

I have a situation where I need to: Do some preamble setup in Script A Start Scripts B, C, D and E together, so they run concurrently When all four scripts have exited, do some cleanup in Script A ...
3
votes
3answers
427 views

Update a network driver through GPO/AD

Our organization has just deployed new computers with Windows 8.1. Roughly 50 of them. We've run into an issue with the driver on the new computers which is flooding the network with ipv6/multicast ...
3
votes
1answer
57 views

Getting WINS Server Statistics

I know WINS is ancient. No need to remind me. For what it's worth, this effort is going toward a project to retire it from the environment altogether. But before I can do that - I need to be able to ...
3
votes
8answers
698 views

How best to monitor and alert on the absence of an event in the logs?

With logs getting captured in syslog-ng, I'd like to be able to automatically monitor the logs and receive an alert if NO log events appear that match a certain criteria. For instance, for a ...
3
votes
1answer
412 views

Powershell and NMAP Information Sharing

I am working on a project where I would like to perform host documentation for a variety of items. Part of these items would be sourced from Powershell and the rest would be sourced from NMAP. For ...
3
votes
3answers
677 views

Email to run a bash script

I have a bash script to restart a service that runs every 3am to guarantee that the service isn't crashed when users require it. However, I need to provide a simpler way for my partner (that isn't ...
3
votes
1answer
186 views

Why start script with /usr/bin/env python

I just downloaded a python script and noticed that the "shebang" line at the top looks like: #!/usr/bin/env python instead of the familiar #!/usr/bin/python What's the reason for that?
3
votes
2answers
311 views

Linux script to identify security issues & generate report

I've previously used a great script on a Linux servers to report on all sorts of security issues. It generates a comprehensive list of potential security flaws on the machine including: out of ...
3
votes
4answers
2k views

How to execute a system-wide script upon any ssh login (with OpenSSH)?

Upon any ssh login/connection (anybody logging in through ssh), is there a way to have a script executed? Using OpenSSH server. The script should not be modifiable by any of the users, -- of course ...
3
votes
1answer
428 views

Force Close a file not a process

I want to write a script that forces closed a specific file and then copies it from one server to another. To manually do this I would use Administrative Tools --> Computer Management --> Shared ...
3
votes
1answer
906 views

Amazon EC2 notifying the instance when the autoscale service terminates it

I am in need of knowing when an instance is supposed to be shutdown by the autoscale, as I want the instances to register themselves and deregister themselves from a given service. I know that the ...
3
votes
2answers
4k views

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 ...
3
votes
4answers
316 views

Good shell scripting guide

I have the Orielly's "Learning bash". I also refer to Advanced Bash-Scripting Guide(tldp.org/LDP/abs ). Any other good books on the subject ?
3
votes
1answer
490 views

IIS 6 Logging on a webfarm

Is there away in IIS 6 to programmaticly turn on/off logging in a web farm. we have 10 servers and I don't want to when needed log on to each and flip logging on, and then when we are done login and ...
3
votes
2answers
983 views

Can I use rsync to create a list of only changed files?

I am using rsync in a bash script to keep files in sync between a few servers and a NAS. One issue I have run into is trying to generate a list of the files that have changed from the during the ...
3
votes
1answer
256 views

Change shortcut arguments via script

We have a program here that requires every user to have a shortcut on their desktop that points to an ini file. Each file is unique to the user. Recently, we've done a new install of the application ...
3
votes
1answer
2k views

How to retrieve the current Windows NLA network location from command-line?

We have a Windows Server 2008 R2 domain controller which always sets its NLA location to 'Network 3' after a reboot. Without fail, this defaults to Public, which screws with my Domain profile ...
3
votes
2answers
897 views

Backup script to FTP with timed subfolders

I want to make a backup script, that makes a .tar.gz of a folder I define, say fx /root/tekkit/world This .tar.gz file should then be uploaded to a FTP server, named by the time it was uploaded, ...
3
votes
6answers
2k views

Windows XP autostart process as administrator

I am looking for a way with which i can autostart a certain program on logon of a user with user-rights with administrator-rights. I already tried using task scheduler but it didn't work out because ...
3
votes
1answer
1k views

Verify who has Bitlocker key backed up via PowerShell?

We currently use Bitlocker on our laptops here at work. The helpdesk are responsible for backing the Bitlocker key up to AD when they build the system. We ran into an issue recently where a user had ...
3
votes
1answer
239 views

Rsync: General file/folder synchronization

I have a file server, which is in-charge of pulling a folder tree from multiple workstations on a daily basis. My current method for this is by using rsync, (which works pretty well provided directory ...
3
votes
2answers
2k views

Linux: ssh to host and use sudo to run a script, runs but part of script fails

I've searched high and low for an answer to this. I have keys setup so no password is needed for the ssh into remote host. I have sudo set up with that user so that I can run the needed commands as ...
3
votes
1answer
141 views

Test file for specific permissions

I have a script where I'd like to test a file for specific permissions, specifically 0644, if it is not that then chmod it. I know I could just chmod it and let it fall through in case it already was ...
3
votes
1answer
968 views

How to create a Windows 2008 Advanced Firewall rules group definition through the command prompt

Is there a way to create a group, or add to an existing group, to a rule in Windows Advanced Firewall (preferable through a command prompt or WSH script). Edit:
3
votes
3answers
2k views

How do quotes/strings work in Powershell?

I'm have a command line that works in the regular old Windows Command Shell, but somehow gets misinterpreted in Powershell (I'm fairly new to Powershell). sqlcmd -S .\SQLEXPRESS -i ...
3
votes
2answers
2k views

Run command before and after printing with CUPS?

this is a home setup. A central printer server (Linux) manages the queue, a HP 2430DTN is attached to it via 100Mbit/sec Ethernet. The printer is hooked up to a managable power source. A shell script ...
3
votes
2answers
1k views

Why is `slapconfig -backupdb` not creating disk image when run from cron on Snow Leopard Server?

Years ago I put together the following expect script to perform Open Directory backups under Tiger Server and it's worked well under Leopard Server as well: #!/usr/bin/expect -f set date [timestamp ...
3
votes
2answers
397 views

How can I know when a Xen VM has started when starting using CLI

I'm using XenServer as a host for disposable QA machines for our application development. I'd like to write a script that automatically creates a new VM from a template, starts it, logs into it, ...
3
votes
2answers
225 views

What are the most prefered languages for writing a login script? Why? [closed]

I am in the process of building a new windows domain (migration from Novell) and need to write a login script to map network drives/printers. In the past I have used vbscript mixed in with a little ...
3
votes
2answers
2k views

Remove all recurring meetings scheduled by terminated user

I am looking for a way to efficiently and effectively remove all meetings that a terminated user may have created during their tenure. Currently, our group has to grant admin access to the user's ...
3
votes
1answer
313 views

Powershell script for setting password expiry

Due to mistakes by the helpdesk staff, I found that over a 100 user accounts in my company AD have been set so that their passwords never expire. To avoid the situation in which all these users ...