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.