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)

4
votes
2answers
7k views

delete registry key using wildcards

I'm hoping to find a way to delete registry keys based on wildcards using a batch file rather than writing some vbscript. Does anyone have an example? I'm forced to proceed with MS's wonderful ...
4
votes
2answers
8k views

Is it possible to change BIOS settings from Linux?

I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6. I understand ...
4
votes
2answers
1k views

Is it possible to have a scheduled task click a button in Windows?

One of my clients has an application that can not be run from command line or via API but needs to be run on an scheduled basis. It would require that I launch the application if it's not already ...
4
votes
3answers
250 views

Windows Server 2008/2003 - determine all “used” local network ports

I have been tasked with enabling the local firewall on 100+ servers. The systems are running many different applications using many different ports. I began with an nmap scan, but without going to ...
4
votes
1answer
73 views

Do you Suspend-ClusterNode before or after Move-ClusterGroup?

Which do you do first to avoid service interruption? Or does it not matter? Is it: Suspend-ClusterNode -Drain Get-ClusterNode $env:COMPUTERNAME | Get-ClusterGroup | Move-ClusterGroup or: ...
4
votes
2answers
1k views

How to get from a Hyper-V 2008 R2 node with Powershell the IP address and Vlan ID

I tried to take from the Hyper-V (Hyper-V 2012) node with this command the IP address: Get-VM | select -ExpandProperty networkadapters | select vmname, ipaddress The thing is that i take as an ...
4
votes
1answer
1k views

Trying to monitor file/folder changes on the server and send notification. What am I dong wrong?

I am trying to make a script to monitor a directory of the EC2 webserver I am managing. I found inotify and tried to make the following script but upon trying it nothing happened. #!/bin/sh while ...
4
votes
1answer
433 views

I'm looking for a robust way to determine if a service can be stopped or killed

I'm looking for a robust way to determine if a service can be stopped without data loss or corruption, or if a regular stopping will work if the service can be killed via powershell. I thought about ...
4
votes
1answer
3k views

Shorcut to list pending updates in Microsoft Windows

Is it possible to create a shortcut to "View update history"? Or, do you have a script (powershell, vbs, cmd, ...) to list pending updates?
4
votes
2answers
474 views

Scripted forwarding for Outlook 2003

We have a staff member in sales who has gone onto a 4 day week (getting ready for retirement), so each Thursday afternoon her email needs to be forwarded to another user and each Friday afternoon it ...
4
votes
2answers
299 views

Any ideas for automatic initial/scripted configuration of a NetApp?

The background is to make a solution where we can automate as much as possible the building up of ‘pods’ that include server/network/storage and that will be built at remote sites. In an ideal world ...
4
votes
3answers
494 views

How do I launch a command on a remote computer with an invalid domain trust? (using local creds)

I intend to use WMIC to reset the trust of a machine that is remote, and off the network. All of the following variations result in an "access denied": The following works fine: net use ...
4
votes
1answer
1k views

How to get Mailbox Folder Permissions with SamAccountName or UPN?

I need to collect and store the folder permissions for each folder in each mailbox of our Exchange system. I'm already aware of the Cmdlet Get-MailboxFolderPermission but it has a serious problem. ...
3
votes
3answers
169 views

How to know that my IP is invalid

I have a script running that will start up an interface with a new IP. If the script comes up with an IP that is already in use i am in trouble. Is it possible that the script set up the new Ip, ...
3
votes
6answers
2k views

How to periodically remove all content from a file without deleting it

I need to periodically empty a text file without deleting it (I know how many lines it has). I tried this: Created a cron that executes the following script other lines from the script here sed ...
3
votes
2answers
514 views

Bash script not working with `sh`

I'm testing a simple script and I'm wondering why it works fine when executed from directory: ./test.sh but when I try with "sh" command sh test.sh it's not working: test.sh: 3: test.sh: [[: not ...
3
votes
5answers
2k views

Is it worth while to learn Awk?

I am decent with bash scripting and I am catching on to regex, and a little sed usage. Is learning awk still worth while with all the alternatives out there. Opinions?
3
votes
7answers
33k views

Batch file to MASS ping group of computers on network by name, check reply, and resolve hostname

So, I have a list of 5000 computers on my Windows Active Directory network that may or may not still exist (I know, don't ask...I need to know for a project, and of course little help from the network ...
3
votes
3answers
4k views

How can I easily convert HTML special entities from a standard input stream in Linux?

CentOS Is there an easy way to convert HTML special entities from a data stream? I'm passing data to a bash script and sometimes that data includes special entities. For example: "test" ...
3
votes
4answers
4k views

Testing for a script that is waiting on stdin

Is there a way to determine if a script is waiting on stdin and cause the command to exit if detected? Here's an example, the command I'm executing takes a long time to run, but it will also prompt ...
3
votes
2answers
3k views

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 ...
3
votes
5answers
1k views

linux logfile does not open correctly in windows notepad

I have a small piece of code on my red hat linux box like echo $ddate";"$time";"$cpu >> /home/logfile The output is in vi 2010-04-10 12:23:32;01 2010-04-10 12:23:32;01 2010-04-10 12:23:32;01 but ...
3
votes
3answers
1k views

Year Month day from file name in shell script

I hava file names like below adn_DF9D_20140515_0001.log adn_DF9D_20140515_0002.log adn_DF9D_20140515_0003.log adn_DF9D_20140515_0004.log adn_DF9D_20140515_0005.log adn_DF9D_20140515_0006.log ...
3
votes
1answer
818 views

How can I automatically delete /tmp folder on shared drive?

We have a /tmp folder that people use for temporary stuff. It can be anything and any file. We want to make it so that this automatically deletes (or preferably MOVES to another folder on the same ...
3
votes
2answers
88 views

what type of scripting is this and is it suggested for my environment? [closed]

First of all, I hope I am not duplicating another post. If so I will delete immediatly. I have gone through many of the questions/answers on this website trying to find what scripting language I ...
3
votes
3answers
7k views

Powershell Parameters

I have a Param block in my script Param ( [Parameter(Mandatory=$True)] [string]$FileLocation, [Parameter(Mandatory=$True)] [string]$password = Read-Host "Type the password you would ...
3
votes
1answer
193 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
148 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
9k 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
9answers
3k views

Scripting during Linux boot: how to test when boot is “complete”?

I've got a script that gets run during boot on a Debian server. It's getting run too early, but I can't control when it's fired off. I can force the script to delay its own run with: sleep 60 ...
3
votes
4answers
2k 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
2answers
188 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
3answers
285 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
1k 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
3answers
3k views

Password less sudo in script

I have passwordless access to a server. My user account has added in sudoers file for NOPASSWD usage for some services/daemons in /etc/init.d/. I want to write a script to start or stop a daemon ...
3
votes
3answers
10k views

How to Run a script when a mail arrives in mail server? (Debian)

I want to parse and insert some information from the mail that just arrived in a mission critical application's mail server. I there any way to configure my mail server so that it run a script when ...
3
votes
1answer
909 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
4answers
4k 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
2answers
4k 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
5answers
590 views

PowerShell prompt to continue execution of code

I have a script I am using to automate WSUS processes, and the last stage of it goes on to remove all old/unnecessary files/objects. I would like to prompt 'Press 'Enter' to continue with removal or ...
3
votes
1answer
2k views

Powershell script scheduled task will not end

I want to use this Powershell script to automate some backups on Win7 machines. When run manually from the Powershell terminal the script runs as advertised and ends after a few seconds (it is a small ...
3
votes
2answers
1k 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
8answers
1k 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
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
2k views

More efficient method to synchronize very large # of files

I have a large directory that needs to be synced from a local server to my web server and am looking for the most efficient method of doing this. This directory contains 113k files in 14k directories ...
3
votes
3answers
5k 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
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
3answers
569 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
1k 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 ...