Search This Blog

Wednesday, October 05, 2011

Running command on multiple computers

Just a quick note to show how to run a command  against multiple computers.

Have a file with a list of computer names (1 name per line).

net time example

FOR /F "eol=# tokens=1 delims=," %A IN (.\serverlist.txt) DO net time \\%A>>c:\output_command_netime.txt

So the command above will run the net time command on each of the servers in the file serverlist.txt. Each server name is passed to the command through the variable %A.

server1

server2

server3

serve…

The output in this command is redirected into a file called output_command_netime.txt. It must be said that the output is appended to the file, so if you this multiple times, be away it will just add to the existing file. Just delete/rename the file if you want a new file on next run.

More examples

examine the state of a service

FOR /F "eol=# tokens=1 delims=," %A IN (.\serverList.txt) DO sc \\%A query w32time>>c:\output_command_sc_query2.txt

start a service

FOR /F "eol=# tokens=1 delims=," %A IN (.\serverList.txt) DO sc \\%A start w32time>>c:\output_command_sc_start.txt

stop a service

FOR /F "eol=# tokens=1 delims=," %A IN (.\serverList.txt) DO sc \\%A stop w32time>>c:\output_command_sc_stop.txt


Share/Bookmark

Tuesday, October 04, 2011

Cisco PIX

This posting is mainly for myself, so I have reference when I come back to configure this firewall. I am not a cisco person. This is not the whole story here, just highlights for me. Surprised smilePlease do not take any of this as golden as it is just notes for me and maybe incorrect at this time.

I had to configure a cisco pix the other day, it was setup for natting. Now I had to add ntp and dns access.

So I assumed I would have to setup an access list and assign it.

However in doing this I broke existing connectivity.

It appears that by setting up global natting the firewall then allows all access via this nat.

When I applied my access list to allow connectivity to the new service, it actually stopped existing access.

So by applying the access rule, it then stopped the default all access and only allowed access to the rules I had setup. So to get service back I had to either unbind the access-list which restored the all access or add the rules as and when (my preferred option).

setup named objects

name <ip> <name>

setup object-group

object-group <object group name>

  description <description>

  network-object host <name – as configured with name>

setup access-list (early versions of pix only allow numbered (id) access lists)

access-list <acl id> permit <protocol> any object-group <object group name> eq <port>

bind acl to interface

access-group <id> in interface inside

Global nat (apply to all traffic)

global (outside) 1 <start ext ip range>-<finish ext ip range> netmask 255.255.255.0

nat (inside) 1 0.0.0.0 0.0.0.0 0 0


Share/Bookmark

Monday, October 03, 2011

IIS7–Self Signed Server Certificate

I had to create a self signed certificate to run on an exchange web access site.

After looking around I have found the following Microsoft tool

selfSSL7.exe (it  is for IIS7, there is an selfSSL for IIS 6).

Ref: http://blogs.iis.net/thomad/archive/2010/04/16/setting-up-ssl-made-easy.aspx

This tool allows you create a certificate for a specified common name, something the GUI in IIS7 does not allow you to do (as it adds the server name).

I had issue running it on the server where IIS was installed, it kept moaning about .net framework issue. I was nervous about messing about on the server with .net so I put selfSSL7.exe on to another IIS7 server.

The command I ran was this, it was for blinkdinkyowa.blinkydinky.net (an example name), with a Key of length 2048, valid for 365 days. It is also exported the file to a pfx file, which would allow me to import to the correct server.

selfssl7 /N cn=blinkdinkowa.blinkydinky.net /K 2048 /V 365 /X /F .\blinkdinkowa.blinkydinky.net .pfx /W <password>

So on the correct server I opened IIS, clicked on the server, and open server certificates. Right clicked and imported the pfx file.

In addition I opened an mmc, with the certificates snap in and imported the certificate into the Trusted Root Certification Authorities. This just allows the server to trust the certificate.

I then jumped into the website bindings in IIS7, and set the https binding to use the new certificate.


Share/Bookmark

Tuesday, September 20, 2011

Picasa UNCs (Network Shares)

I have a central server, running a RAID5 array. I store all my important files here including my pictures. The server is backed up in addition to the RAID5 array.

Now we also have a number of laptops in the house, including my wifes. I wanted to keep all the pictures central, but allowing my wife to view them all from her laptop.

Easy I thought, I’ll just add a UNC to folder manager in picasa… lol. Nope Picasa does not support UNCs, after traipsing the net and trying to modify the watchedfolders.txt file for picasa (with limited success). Something reminded me of what I did to share a USB drive from within a existing local folder (its in another blog post). I used mklink.

mklink comes with Vista and 7. It allows to create file and folder links within existing folders, and as a bonus it allows for uncs to be used.

So with Picasa running on the laptop looking at the local pictures folder, I then created a directory junction using mklink that pointed to the server share.

Picasa now sees that folder as nothing more than a subfolder and as such just scans through the folders. Smile

C:\Users\<username>\Pictures>mklink /d <~NewFolderName> \\<Servername>\<servershare>

Now I use ~ at the beginning of files and folders to ensure they appear at the top of any listing. Just reminds me that the folders/files have special significance. (So is you don’t want a tilde on the folder name just leave it out here.

I hope that helps someone.. I am currently sitting here waiting for picasa to finish cycling through the folders…. Surprised smile


Share/Bookmark

Friday, September 02, 2011

Ubuntu: Rhythmbox: clear out library

After importing some folders I wanted to clear out some entries, and reimport. I am sure there should be an option to do this in the GUI but it appears there is not.

Library management is pretty poor in my opinion.

Anyway to do this I had to delete the following file, and restart rhythmbox. 

~/.local/share/rhythmbox/rhythmdb.xml 

~ is linux shorthand for your user folder /home/ /home//.local/share/rhythmbox/ 


This works for ubuntu 11.04 and Rhythmbox 0.13.3.  It has been known for them to keep moving the the file around, so if you have a different version this may be in a different location. The file should be the same so you should be able to search for it.
Share/Bookmark

Monday, August 15, 2011

Getting round restricted Windows filenames (unc)

I recently had an issue with restricted filenames.

Normally windows will not let you create a file that has one of the restricted filenames, this is a hangover from windows past.

CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL

One of the systems used a UNC reference to access storage on a remote server share. By using the UNC the access allowed the system to create a file called con.xxxxx.doc, this file was in fact an uploaded user file.

The problem came when a backup process tried to access the file locally and compress and encrypt it. The process failed because of the file name.

So what to do. In the end I used the same trick that allowed the file to be created. I just referenced the file using a unc (\\servername\c$\…. etc..) rather than locally (c:\…. etc..)


Share/Bookmark

Thursday, August 11, 2011

Waiting for System Event Notification Service………..

Found this article and its response while experiencing an issue while logging out of a administration RDP session to an win2k8 R2.

I had tried stopping the SENS service which did hung, as described. But I think there is a timeout and the session did finally sort itself out.

I include the content for this article response more for my sanity in the future…

The system event notification issue isn’t an issue with Windows Live messenger… Read below on what I have found.

The fix for this issue is very simple.

First we will examine what causes the issue to begin with. The cause is the COM+ Event Service detects a bad code and hangs. When you go to services.msc you won’t see the service hang but believe me it is. If you try to stop the server you will then see it hang and you won’t be able to get it back started. You can’t kill the process via taskmgr because its a svchost.exe service so you’ll never know which one to kill unless you download a little program call Processor Explorer from Sysinternals.

1. Open Eventviewer and select Application and filter the list so all you see are Error logs

2. Scroll through al Error logs till you come to one EventSystem (EventID=4621) (The COM+ Event System could not remove the EventSystem.EventSubscription object {C986B80D-E6CE-4FB0-9A44-F19BF27C165A}-{00000000-0000-0000-0000-000000000000}-{00000000-0000-0000-0000-000000000000}. The HRESULT was 800706be.)

3. Ok now open Process Explorer and sort by process name

4. Find the list of svhost.exe and start right clicking each and selecting Properties.

5. After hitting Properties on each services make sure you are selecting the Services tab and look for the svchost.exe process that has the EventSystem service which its display name is COM+ Event System

6. Now close the box and right click on the svchost.exe process and select Restart

7. Instantly once the service shuts down and restarts you will notice in your taskmgr that the users that were hung are now gone and they can now login and logout as they please

8. There are some services that won’t start back up after restarting this service so make sure you go back into services.msc and sort services by automatic and start up the ones that aren’t running.

This should resolve your issue until you get another SystemEvent error in Event View, but then just follow these steps and you are fine. The greatest thing about this fix is it doesn’t require a reboot like all the millions of thread out there about this issue, because the issue isn’t resolved by a reboot.

I am definitely interested in hearing if this has worked for you so please let me know.

Thanks
Jeff

There is also a large thread on the Microsoft forums about this, and it may be worth going through this if you don’t have any joy here.

http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/65634267-8550-4b96-b6d1-6e020859aee7/


Share/Bookmark