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
3answers
4k views

Importing a large SQL script into SQL Server?

I'm trying to move a database from our production server to our test server. I've used Microsoft's Database Publishing Wizard to create a script containing the schema and data for the production ...
4
votes
5answers
856 views

Bash: Quotes getting stripped when a command is passed as argument to a function

I am trying to implement a dry run kind of mechanism for my script and facing the issue of quotes getting stripped off when a command is passed as an argument to a function and resulting in unexpected ...
4
votes
2answers
4k views

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

Find GUID of MSI Package

How can I find the GUID of an MSI package? I would like to script the removal of a program on a large number of desktops by using: msiexec.exe /x ProductCode Any reason why this would not work ...
4
votes
2answers
91 views

OK to modify HKLM\Software\Policies and HKCU\SOFTWARE\Policies on a domain?

Background: I have a domain (2003 Functional Level) with a mix of Windows XP and Windows 7 clients. We have been using Group Policy to manage our workstations. Now, I am in a situation I need to ...
4
votes
5answers
1k views

Powershell script to delete oldest files (not relative to current date)

I DO NOT want to "delete files older than X days." If I wanted to do this, I'd just pick one of the thousands of scripts out there that have already been written for that purpose, and I wouldn't ...
4
votes
1answer
4k views

Batch script to test if a folder exists fails when checking a UNC path

I've written a small batch file to help us with a server migration to remap user directories using GPO. However in the batch file I'm having a syntax problem that appears right but it's still ...
4
votes
2answers
246 views

Repartitioning two disks without a loss of data

I am interning at a software company and I have hit somewhat of a brick wall. Here is the deal: The Problem: We have some boxes around here that were incorrectly partitioned for 2 x 500 GB drives. ...
4
votes
3answers
1k views

How would I create a PDF print server?

I have some old workstations with WindowsXP that I can install pretty much anything on, an office with about 80 people, a wintel environment, an existing Server 2003 file/printer server, and everybody ...
4
votes
1answer
3k views

How to stop Subversion from prompting about: Server certificate verification failed: issuer is not trusted

I need to be able to deploy new instances of an application from a subversion repository. This is accomplished by running shell_exec() from a PHP script. However, Subversion won't let me check out ...
4
votes
1answer
4k views

How does Outlook identify “Extra Line Breaks”

I am writing a script that emails the output to me, and I read it in Outlook. For some reason Outlook removes all the line breaks in the message, and gives me a little notice that it has removed the ...
4
votes
2answers
226 views

Is it possible to use Puppet to ensure multiple files in a directory are present without defining all of them?

I have a couple hundred one-off servers that have different configuration files that need to be present in a directory. Copies of the files reside on the puppet master. Within one of my classes I ...
4
votes
6answers
3k views

email output of powershell script

I found this wonderful script that outputs the status of the current DFS backlog to the powershell console. This works great, but I need the script to email me so I can schedule it to run nightly. I ...
4
votes
4answers
5k views

Parse and convert ini into bash array variables

I'm trying to convert an ini file into bash array variables. The sample ini is as below [foobar] session=foo path=/some/path [barfoo] session=bar path=/some/path so these become ...
4
votes
1answer
2k views

How can I find all groups a user belongs to via DSQUERY

How can I find all groups for a specific user (groups for which the user is assigned) using dsquery?
4
votes
2answers
3k views

Create kickstart configuration file from existing configuration

Is there a script or another way to automatically generate a kickstart configuration file from the system state of an existing server so that the file can be use to replicate (not clone) the ...
4
votes
2answers
6k 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
6answers
5k views

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 ...
4
votes
2answers
383 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
237 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
3answers
580 views

Moving to an outside Exchange provider - How to create new Outlook profile on multiple PCs?

Following an acquisition we are switching from our local Exchange to an outside provider. I need to change account settings / create new profile so that users are able to access their new mailbox, and ...
4
votes
1answer
645 views

Assign Static MAC address to VM Hyperv

I have a scenario that involves building out a ton of virtual machines in Hyper-V, I cannot use SCVMM and must use a scripted method to create these VMs. I have a CSV with all required information ...
4
votes
2answers
341 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
278 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
1k 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
1answer
162 views

Is there a way to script the installation of System Center Configuration Manager updates listed in Software Center?

We have a very tight outage window and for many of our systems, the servers must be rebooted in the correct order. Because of this, I would like to script our updates. I have attempted to use this ...
4
votes
2answers
429 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
240 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
2answers
74 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
509 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. ...
4
votes
2answers
844 views

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 ...
3
votes
3answers
166 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
759 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
300 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
7answers
24k 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
8answers
489 views

What have you used Makefiles for (besides build automation)

Makefiles are great for automating builds, installs and tests. But, that is not the end of Make. I have used makefiles to do many tasks like cleaning up logs, keeping mirrored web pages and ...
3
votes
5answers
520 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
4answers
2k 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
3answers
216 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
425 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
85 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
1answer
154 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
146 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
5k 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
3answers
2k views

Change Passwords for All Users on Linux Server

I've got 10 Linux servers that I need to lock down, by resetting the passwords for every single user all at once. The story behind this is long, but the general idea is that I need it to happen very ...
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
206 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
629 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
824 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 ...