Mad-ITskills.com

The source for random IT information

I was given a list of computers with their current IP address & MAC address.  They needed to know which of these computers on this list had a DHCP reservation.  The list was about 150 computers.  I wasn't about to look up each of these in DHCP manually.  So after some searching I found a way to dump all the reservations into a spreadsheet.  Here's how I accomplished this.

I logged into the DHCP server and ran the following command (from a cmd prompt):

netsh dhcp server dump >> C:\Temp\DHCPinfomation.txt

This command gave me a text file with all the information in the DHCP database.  There's a lot of information here and all I wanted was the reservations.  I found each reservation had the following text in the line "Add reservedip".  Each line looks something like this:

Dhcp Server \\dhcpservername.fqdn Scope 10.10.10.0 Add reservedip 10.10.10.10 0021b7c0075a "reservation name" "description here" "BOTH"

From a command prompt I then used the find.exe command to display only the lines with "Add reservedip" in it with this command.

Find "Add reservedip" DHCPinformation.txt

I then copied those lines into another text file.  I then imported the text file into Excel and I used space as a delimiter.  So each field would be in it's own column.

From there it was copying the MAC and IP address out a new sheet and then copying the MAC from the original list I wanted to compare against to it's own sheet and then I used a vlookup in excel to find the ones MAC addresses that existed in both sheets. I'm not excel guru so it's hard for me to step by step how I accomplished this but if you google search you can find how it works.



I wanted to find all the old computer & user objects that haven't logged into the domain in awhile.  With the native Microsoft Active Directory powershell module I thought this would be a simple task.

I wrote scripts easily enough that pulled this information out and dumped it all to a CSV file.  I utilized the powershell cmdlets "Get-ADUser" & "Get-ADComputer" along with the attribute "LastLogonDate".  I then realized this wouldn't work because the "LastLogonDate" attribute is per domain controller and not across the entire domain.  So that would only work correctly if I had a single domain controller.  I then found there are 2 other attributes in regards to logon time events.  Those 2 are "lastLogon" & "lastLogonTimestamp".  I did some research on the difference of these 2 and found out that "lastLogon" again is to a single domain controller that you are running the cmdlet against but just in a different format from "LastLogonDate".  "lastLogonTimestamp" is the last time the user/computer logged into the domain at all.  So I went with this one.

So I changed my script to utilize "lastLogonTimestamp".  It ran fine but there was an issue.  The format of the data of the "lastLogonTimestamp" is basically unreadable.  It's just a long number.  I did some research on the number and basically the number it gives us is Windows Epoch time.  Which means the number it gives is the amount of time since Jan 1, 1601.  So I needed my script to convert this number to a normal date format.  It took a while to get it right but I wrote 2 scripts.  One for Computer Objects and One for User Objects.  Each script just generates a CSV file that can be imported into Excel for correct formatting.  Before I get to the scripts I want to make it noted that even the "lastLogonTimestamp" attribute isn't exact.  It can be off by around 9 to 14 days.

Here is the script for computer objects:

#The 90 is the number of days from today since the Computer has last logged into the domain.  Change it to whatever number you want.

$then = (Get-Date).AddDays(-90)

$OLD = Get-ADComputer -Property Name,lastLogontimestamp,OperatingSystem -Filter {lastLogontimestamp -lt $then}

                foreach($svr In $OLD)

                {

   $mydatetime = $svr.lastlogontimestamp

$time = [datetime]::FromFileTime($mydatetime)

$svr.Name + "," + $svr.OperatingSystem + "," + $time | Out-File OldAdComputerObjects.csv -append

                }

 

---------------------------

Here is the script for user objects:

$then = (Get-Date).AddDays(-90) #The 90 is the number of days from today since the user has last logged into the domain.

$OldUser = Get-ADUser -Property Name,SamAccountName,lastLogontimestamp -Filter {lastLogontimestamp -lt $then}

                foreach($User In $OldUser)

                {

   $mydatetime = $User.lastlogontimestamp

$time = [datetime]::FromFileTime($mydatetime)

$User.Name + "," + $User.SamAccountName + "," + $time | Out-File OldAdUserObjects.csv -append

                }



I recently setup a new vCenter 5.1 environment.  One of the first things I noticed was when logging into vCenter it required a full UPN (User Principle Name) or a domain\username format to log in.  In previous versions you could just log in with username & password.  It was a little annoying but I didn't really care as I needed to get everything in vCenter configured.  

I then decided to research how to set it so I didn't have to type in the @domain.com or domain\ format.

I found out this behavior could be changed.  Steps on changing it:

1.  Log in to the vCenter web (can't set this setting from the J# client)

2.  Click on "Administration" from the left menu.

3.  Click on "Sign-On and Discovery"

4.  Click on "Configuration"

5.  Locate your LDAP binding configuration under the "Identity Sources" tab.

6.  Click on your LDAP config then at the top next to the red X there is a button called "add to default domains".  Click It.

7.  You will get a warning about locking out accounts but it is safe to proceed.  Once that is done click the "save" icon at the top and you're good to go.

Logging into vCenter from the web or from the J# client will no longer need the UPN or domain\ format!



Some of my users were complaining that an application is much slower now on XenApp 6.5 than it was on Presentation Server 4.5

I did some digging into what they were doing and basically from the application the user would browse to a .dat file on a windows server 2003 file server and the application would read the file.  Well this process would take minutes on XenApp 6.5 when it used to take less than 20 seconds.

 

I decided to take a packet capture from each environment when this process was going on and I found something very interesting.  The size of the packets on the old environment was 4K and on the new environment the size of the packets were 512bytes!  Also I noticed in the packet capture what was different was Opportunistic locking was disabled on the XenApp 6.5 environment.

 

I found a reg key in windows called "OpslocksDisabled" and the value was set to 1 on the Windows 2008 R2 servers.  Once I set this reg key to 0 and rebooted the XenApp 6.5 server I ran the process again and it was fast once again!  I took a packet capture and the packet captures were identical now!

-------------------------------------

The reg key is located in the following location:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters\

OplocksDisabled REG_DWORD 0 or 1

-------------------------------------


0 is the way to go if your file servers are server 2003 (SMB 1.0)



So I had an in house written application that wouldn't launch correctly on a Server 2008 R2 Terminal Server.  It kept throwing an error about a dll.  I had registered it multiple times already by launching command prompt and using regsvr32 filename.dll.

I downloaded RegDLLView just to make sure it was registered.  It was registered however I noticed that the dll only had 1 system entry registered and 3 user entries!  I had never known that dlls had system and user entries!

So how do you register a dll with system entries and not user entries?  I did alot of googling and was unable to find anything but I did manage to figure it out!

 

When I launched command prompt I was launching as Administrator.  I found that when I did this it would register the dll with user entries.

I did a start > run > cmd & enter and registered again and it registered my dll with 4 system entries!



Who has seen Error 0xc000000e while booting windows and it fails to start?  I got this error today and was able to repair!

I removed a boot hard disk from a VM today and mounted it to another so I could delete some files that I couldn't because certain apps had them open.

When I mounted the VMDK back to the original VM that VM wouldn't boot!  I was getting the following error.

So, how did I fix it?

I booted from a Windows Server 2008 R2 SP1 ISO and chose the repair option.  I chose the command prompt and took at look at Boot Configuration Data like so.

Notice under the Windows Boot Loader the device is "unknown".  This normally says partition=C:.

I ran the StartRep.exe from X:\sources\recovery.  Like so:

VOILA!  When it completed Windows booted successfully!



May
14

Citrix Synergy!

by Jody K. Wong | Tags:

I was at Citrix Synergy last week.  It was the first Synergy I've attended.  It was a great event and I enjoyed it.  Here's a rundown of sessions I sat through and my opinion on the sessions.

 

Wednesday the 9th:

8:00 AM  "Best Practices for Provisioning XenDesktop" - This was kind of the basic differences for MCS and Provisioning Server.  They did go over the new personal vDisk product (this is the ringcube technology integrated into XenDesktop).  

9:00 AM "Deep Dive on XenDesktop personal vDisk" -  This was a more in depth session on how personal vDisk worked.  It was a good session, they covered a lot in a short amount of time.  Soon as the presentations are downloadable from the MySynergy site I want to download the presentation on this and review.

10:00 AM Opening Keynote - This was a opening presentation about some of the new acquisitions and new integrations into the Citrix product portfolio.  They unveiled a new HP all-in-one PoE Thin Client.  It was pretty cool.  Even the monitor is PoE!  It's litterally 1 wire if you are using a wireless mouse/keyboard like they used during the presentation.  Pretty cool product.  Recently Citrix acquired Podio so they showed that, which is sort of an intranet for projects with also being able to access your citrix published apps and desktops from within the podio intranet.  The "big" announcement was Project Avalon.  I'm not so sure it's that big of a deal.    Not sure if I completely understand all that it can do but it sounded like being able to manage  your XenDesktop & XenApp environments from the cloud.  Maybe a cool thing for service providers?

2:00 "Configuring the personal vDisk feature of XenDesktop 5.6 with provisioning services" - This was a 3 hour lab on setting up the new personal vDisk feature of XenDesktop.  Cool class.

 

Thursday 10th

8:30 AM - Day Two General Keynote - More general overview of Citrix product portfolio.  Nothing ground breaking... they talked about cloud computing, and how Amazon was leveraging Citrix products for building their cloud... blah blah blah.  it was kinda boring and I was falling asleep :)

11:30 AM "Begin your desktop transformation jouney with Citrix Consulting best practices" - This was a good session about the proper steps of doing a VDI project and how to leverage Citrix Tools to get there.

2:00 PM "Successful desktop transformation design with Citrix Consulting best practices" - This was a part 2 of the "Begin your desktop transofrmation journey with Citrix Consulting best practices".  They went over all the different FlexCast models (basically different choices for implementing XenDesktop).  I don't really remember too much else during this session.

3:00 PM "What's new in XenDesktop and XenApp"  - They talked about what is upcoming with the products.  In XenApp they talked about the new printing server technology.... nothing else really came to mind for XenApp.  They talked about personal vDisk for xendesktop more.

4:00 PM "Can the CTPs stump the Citrix architects? (GSL!) - Not much in this session really... just some questions from the crowd.  Kind of a waste of time.

 

Friday May 11th

9:00 AM "Spotlight on Citrix Receiver for Tablets and smartphones" - This was kind of a fluff session, they showed how windows apps are getting better on tablets by how the keyboard is better working and will automatically popup when you put the cursor into a typing field.  They really pushed that aspect.  They also showed how the new Citrix Sharefile product is built into the Receiver for Tablets/Phones.

10:00 AM "What's new for HDX" - The title says it all.  They talked about HDX 3D Pro... don't really recall anything else.  Nothing major.  I believe they showed a video and how smooth it was going over HDX 3d Pro.

11:00 AM "Tips and best practices for hosting XenDesktop on vSphere" - This session was presented by Elias Khnaser (CTP, VMware vExpert, & CEO of Sigmas Solutioins).  I read one of this books before so I wanted to sit in on this one.  It was about alot of tweaks and settings for vSphere for the most part.  He did talk about making sure to use LACP for your vSwitches but I know that you can't use LACP unless you have Cisco Nexus 1000V without 1000v you can only use standard Etherchannel.  I called him out on this and he wanted me to email or tweet to him about it.  So I found the VMware article and tweeted him.  He replied and said he meant to use Link Aggregation in general and not Cisco LACP.....  So who's right?  me or him? :D

2:00 PM "Hypervisor showdown:  what solution is best and does it really matter? (GSL!)" - They started by asking who was using VMware now and about 95% of the room raised their hands (LOL).  After and 2 minutes this became a XenServer bashing session.  People were really complaining and bitching about how crappy managing XenServer is.  I wanted to make a comment but never really got a chance too.  Here's my opinion:

ESX/ESXi is VMware's bread and butter product.  They put tons of money into R&D of this product.  Its an expensive product but it is definitely worth it, you are paying for all that polishing and maturity.  That's why it is the better product.  As for Citrix, they have been a software for Windows company since 1996.  XenApp & XenDesktop is their focal point and that's why those 2 products are better than anything VMware puts out.  As for XenServer, it was an acquired product.  They didn't build this from the ground up and I honestly don't feel like they put a lot of money into more development of it.  Much of the complaining was about not being able to do everything from XenCenter and how it has a lot of bugs.  I agree that this is true but you get what you pay for.  It's a cheaper product and there's a reason why it's cheaper.  IMO if Citrix wants XenServer to be used in the enterprise they need to put more money into it, get rid of the whole master xenserver thing and built a management server for it like VMware Virtual Center.  They need to add a SQL DB backend that stores all the cluster data.



This is something different than the normal things I would blog about.  However, it’s useful for many people.  

Everybody has multiple monitors these days, how annoying is it when you double click on a spreadsheet or Visio doc and it opens within the same instance of Visio/Excel?

So, I figured out how to set both applications to the new instance behavior which is default for Microsoft Word 2010.  

Each application has a different way of doing it; I’ll start with Visio because it was easy.

 

1.Launch Visio 2010

2.Click File then Options

3.Click on Advanced

4.Scroll all the way down to the bottom and check the box that says “Put all settings in Windows registry”

5.Click OK & Close down Visio.

6.Launch “Regedit” (If you don’t know what the Registry is, just type “regedit” from the run prompt and hit enter)

7.Locate the following registry key

     a.“HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Visio\Application\”

8.Find the following DWORD

     a.“SingleInstanceFileOpen”

9.Change the value from 1 to 0.

10.Voila!  Click your Visio docs from Explorer folders and watch them open in new instances until your heart is content!

 

Now I thought Excel would be done the exact same way, boy was I wrong!

I searched for a while until I found out how to set Excel to that behavior.

It’s a little more complicated than how it was done for Visio.  Here are the steps.

 

1.Close all Excel Windows.

2.Launch “Regedit”

3.Locate the following registry key:

     a.“HKEY_CLASSES_ROOT/Excel.Sheet.8/shell/Open/command”

4.Double click on the (Default) dword and change the value to the following:

     a."C:\Program Files\Microsoft Office\Office14\EXCEL.EXE" /e "%1"

          i.Note the original value should be the following:

               1.“C:\Program Files\Microsoft Office\Office14\EXCEL.EXE” /dde

5.In the same registry key there is a dword named “command”.  Rename this dword to something else like “OLDcommand”.

6.Locate the following registry key:

     a.“HKEY_CLASSES_ROOT/Excel.Sheet.8/shell/Open/ddeexec”

7.Rename the ddeexec key to something else like “OLDddeexec”

8.Locate the following registry key:

     a.“HKEY_CLASSES_ROOT/Excel.Sheet.12/shell/Open/command”

9.Double click on the (Default) dword and change the value to the following:

     a."C:\Program Files\Microsoft Office\Office14\EXCEL.EXE" /e "%1"

          i.Note the original value should be the following:

               1.“C:\Program Files\Microsoft Office\Office14\EXCEL.EXE” /dde

10.In the same registry key there is a dword named “command”.  Rename this dword to something else like “OLDcommand”.

11.Locate the following Registry key:

     a.“HKEY_CLASSES_ROOT/Excel.Sheet.12/shell/Open/command/ddeexec”

12.Rename the ddeexec key to something else like “OLDddeexec”

13.Finally, that should be it.  Give it a try and your excel spreadsheets should be launching in separate instances!



How many people are used to right clicking the plugin agent icon in the system tray to get a list of all your published applications?  I would assume many.  

Citrix removed this design when Citrix Receiver came out.  Online Plugin is now a "Legacy Client".  However, it is actually still used inside Citrix Receiver.  However, it can't be downloaded standalone.

Now when you right click on the Citrix Receiver icon you can't get your list of applications anymore.  

IT is all about change to make things better, but I don't see how changing the way to make your users find their applications making things better!

So I did some digging and found you can sort of only install Online Plugin still.  When installing receiver, use the following command line and voila.  You can right-click your plugin icon and get all your published apps again!

I could not find this method in any offical Citrix documentation.  I did find a KB article that mentioned the new design and that Citrix wants people to publish to start menu or desktop.

Therefore, I don't know if this method will still be able to be used in the long term.  Let's hope so.

---------------------------------------------------------------

CitrixReceiverEnterprise.exe ADDLOCAL="ICA_Client,SSON,USB,DesktopViewer,Flash,PN_Agent,Vd3d" ENABLE_SSON="Yes"

---------------------------------------------------------------

Note:

I did this with the current version of the Receiver which is 3.0 which was released 8/24/11.



Nov
14

Emploment Change

by Jody K. Wong | Tags:

I have just moved from San Antonio to Austin, TX.  I am a Citrix Engineer for Dimensional Fund Advisors.  My first project is a XenApp 6 deployment.  As I learn cool new things about XA6 I'll update the blog.



Widget Search not found.

Unable to cast object of type 'ASP.widgets_search_widget_ascx' to type 'App_Code.Controls.WidgetBase'.X

Widget Newsletter not found.

Unable to cast object of type 'ASP.widgets_newsletter_widget_ascx' to type 'App_Code.Controls.WidgetBase'.X

Widget TextBox not found.

Unable to cast object of type 'ASP.widgets_textbox_widget_ascx' to type 'App_Code.Controls.WidgetBase'.X

Widget TextBox not found.

Unable to cast object of type 'ASP.widgets_textbox_widget_ascx' to type 'App_Code.Controls.WidgetBase'.X

Widget Administration not found.

Unable to cast object of type 'ASP.widgets_administration_widget_ascx' to type 'App_Code.Controls.WidgetBase'.X

Sign in