Thursday, December 27, 2012

Internet Explorer cannot find the Active Desktop HTML file.

"Internet Explorer cannot find the Active Desktop HTML file. The file is needed for your Active Desktop. To turn off Active Desktop, click OK."

The user clicks OK, but the error is back every time they login.

Go to the user profile under "Documents and Settings\user\Application Data\Microsoft" and add an empty folder called "Internet Explorer".

This worked!

Thursday, November 29, 2012

How to find spammers in my maillog file?


This is the type of record I get when someone authenticates to send email.

Nov 29 09:45:28 ns1 sendmail[30199]: AUTH=server, relay=[1.2.3.4], authid=smithb, mech=PLAIN, bits=0

This command will parse the log file, sort, and count.

grep "authid" maillog | cut -d ":" -f 4 | sort -n | uniq -c

36772  AUTH=server, relay=[176.222.239.10], authid=smithb, mech=LOGIN, bits=0      1  AUTH=server, relay=[24.2.3.4], authid=usera, mech=PLAIN, bits=0      8  AUTH=server, relay=[64.201.195.49], authid=userb, mech=LOGIN, bits=0     94  AUTH=server, relay=[72.201.195.4], authid=userc, mech=LOGIN, bits=0

  The first user has connected to the outgoing server 37k times this week. Someone has hacked their password and is sending spam. I will save this command and find the culprit much faster next time.

I took some inspiration from this post.

http://www.oxxus.net/wiki/Mail_server_log_analyzing

Friday, October 19, 2012

Script to connect to Citrix server from the OSX command line.

Here is the script. I call it ica.

# ica
# Connect to a specific Citrix server from the command line
#
if [ -z $1 ]
  then
    echo
    echo Syntax: ica hostname
    echo
    echo  please enter a hostname
    echo
    kill -SIGINT $$
fi
icafile=tmp.ica
echo [WFCLient] > $icafile
echo Version = 2 >> $icafile
echo [ApplicationServers] >> $icafile
echo \; Name below will appear in the title bar of ICA client >> $icafile
echo \; It MUST be identical to the connectoid header >> $icafile
echo $1 = >> $icafile
echo \; connectoid header is in brackets below\; MUST match friendly name above >> $icafile
echo [$1] >> $icafile
echo \; Server IP address or DNS name goes here >> $icafile
echo Address = $1 >> $icafile
echo TransportDriver = TCP/IP >> $icafile
echo Username = >> $icafile
echo Compress = On >> $icafile
echo PersistentCacheEnabled = On >> $icafile
echo InitialProgram = >> $icafile
echo WinStationDriver = ICA 3.0 >> $icafile
echo DesiredColor = 0 >> $icafile
echo DesiredHRES = %width% >> $icafile
echo DesiredVRES = %height% >> $icafile

open $icafile
Here is how I use it.
ica (hostname or ip)
I copied the Windows Script below and ported it to OSX.

http://www.windowsitpro.com/article/scripting/connect-to-a-citrix-server-from-the-command-line


Thursday, October 18, 2012

What is the quickest way to get an admin command prompt?

z.bat
runas /savecred /user:domain\admin "cmd /K net use z: \\server01\share\utils && z:"
I need admin command prompts everyday. Now clicking on Z in "My Documents" will give me an admin prompt in under one second. It also maps z: to a share with my network utilities. The first time you enter the password and it is saved in your profile. It even works on Citrix servers.


The title bar reminds me this is an admin window!


Wednesday, October 10, 2012

How to get a list of all the clients on a DHCP server.

I needed a list of client IPs and names from two MS DHCP servers. I tried several options before I found this quick command. I initially passed over netsh because it did not provide client names. Then I found out about the "1" parameter.

for /f %%j in ('"netsh dhcp server \\server01 show scope find /i "active""') do netsh dhcp server \\server01 scope %%j show clientsv5 1 >> DHCPClients.txt
for /f %%j in ('"netsh dhcp server \\server02 show scope find /i "active""') do netsh dhcp server \\server02 scope %%j show clientsv5 1 >> DHCPClients.txt

Wednesday, October 3, 2012

I finally started scavenging MS DNS.

I have a guest wifi network with a login portal. Every portable device that comes into the area connects but does not login. They pull a IP address and a dynamic DNS record is created. Whenever I work on the DNS server, I am overwhelmed by all the useless records.

Here are a few stats on my zone.

1459 records
234 iPhones
32 iPads
36 iPods
140 droids

So I looked into scavenging and enabled it one of the DNS servers. I found 2501 in the event log.

The DNS server has completed a scavenging cycle:
Visited Zones     = 14,
Visited Nodes     = 2536,
Scavenged Nodes   = 1923,
Scavenged Records = 3556.
This cycle took 5 seconds.
The next scavenging cycle is scheduled to run in 168 hours. 

Now my zone now has 294 records and no mobile devices at the moment.

Friday, August 31, 2012

How to monitor the number of network connections on a server.


I am troubleshooting a server problem and want to monitor the number of network connections. You need wc (wordcount) for Windows. The choice command gives me a three second delay.

Here is my script.

echo off
:loop
netstat -an | wc
choice /n /d n /t 3 >nul
goto loop

Here is the output. The first column should be the number of network connections on my server.


    234     903   15101
    296    1151   19199
    391    1531   25465
    494    1943   32271
    469    1843   30617
    391    1531   25465
    391    1531   25465
    545    2147   35629
    545    2147   35629


Friday, August 10, 2012

Quick Cisco 3845 IOS update

I have used several methods to update IOS but the easiest for me is old fashioned FTP.

Copy the image from an FTP server to the router.

copy ftp://user:pass@10.1.2.3 flash

Tell the router to boot form the new software image.

boot system flash c3845-advsecurityk9-mz.124-25a.bin

http://proisk.com/?q=c3845-sp (interesting site)


Monday, July 2, 2012

Simple script to clone a Vmware server.


I needed to clone a couple of virtual machines so I installed PowerCLI and created this small script. I can schedule this and have daily backups. I know cloning may not be the best form of backup but this is what I need today.

c:\>type clone.ps1
connect-viserver 10.1.2.3
remove-vm -deletefromdisk "vm1 - backup"
new-vm -name "vm1 - backup" -datastore ds1 -vm "vm1" -vmhost v01.example.com
disconnect-viserver
c:\>

Tuesday, June 26, 2012

Enable remote desktop from the command line.


For some reason the regedit gui would not connect to the remote Windows 7 pc. I used my favorite tool Psexec from the command line and this worked!
reg add "hklm\system\currentcontrolset\control\terminal server" /v fDenyTSConnections /t REG_DWORD /d 0x0
This is how to verify the change.
reg query "hklm\system\currentcontrolset\control\terminal server" 
   fDenyTSConnections    REG_DWORD    0x0

Tuesday, June 19, 2012

Quick speed test between two servers with Iperf.

Iperf for Windows - free and portable!
http://linhost.info/2010/02/iperf-on-windows/

Server A:
iperf -s

Server B:
iperf -c x.x.x.x -P 5

[SUM]  0.0-10.0 sec  1.08 GBytes   927 Mbits/sec
(Not bad for 1gb network.)

The default test is 10 seconds, add "-t 60" for a longer test.

Monday, May 14, 2012

Error 80070483 sending a fax from Windows 2003.

 Here is the code I used for testing. It would work for txt, pdf and docx but not tif or tiff.
C:\fax>type fax.vbs
Set FaxServer = WScript.CreateObject("FAXCOMEX.FaxServer")
FaxServer.Connect "my-fax-server"
Set FaxDoc = WScript.CreateObject("FAXCOMEX.FaxDocument")
FaxDoc.Body = "faxtest.tif"
FaxDoc.Recipients.Add ("4151234")
JobID = FaxDoc.ConnectedSubmit(FaxServer)
C:\fax>
 The problem is tif file association and here is my fix.

[HKEY_CLASSES_ROOT\TIFImage.Document]
@="shimgvw.dll"
[HKEY_CLASSES_ROOT\.tif]
"Content Type"="image/tiff"
@="TIFImage.Document"

[HKEY_CLASSES_ROOT\.tiff]
"Content Type"="image/tiff"
@="TIFImage.Document"




Thursday, March 15, 2012

DNS testing with dig

dig @8.8.8.8 azaleablooms.com -t ns

Google DNS
8.8.8.8
8.8.4.4

OpenDNS
208.67.222.222
208.67.220.220

I just needed a place to jot this down.

Tuesday, March 13, 2012

How to check for GPS tags embedded in your photos.

http://geotag.sourceforge.net/?q=node/3

Luanch the Java app and add photos. Quick and easy.