Using Powershell to get logon script path from Active Directory

If you want to know what logon script users are getting, this is an easy way to get that information:

Import-Module -Name ActiveDirectory

Get-ADUser -Filter * -SearchBase "OU=YourOUName,DC=YourDomain,DC=COM" -properties ScriptPath | Export-Csv "c:\script\ADUser.csv"

Note: In order for this to work, you have to have the ActiveDirectory Module loaded. 

Windows 8 Plans Leaked

So apparently, Windows 8 planning slides got leaked.  A good discussion about what is contained in the slides can be found in this blog post:

Long story short, these slide decks are chock full of internal thinking on Windows 8 — everything from customer target audiences to the Windows 8 developer market to the Windows 8 product cycle and much, much more.

 

While I agree with the author of the post, in that I feel bad for the person who leaked this, I do think it is pretty interesting to get a look at what Microsoft is thinking.  I always find it useful to know now where they think things are going to be in the future, in the hopes that I will make better decisions about how to position myself and the company I work for to take advantage of the “new stuff” when it gets here.

SCVMM and P2V Adventures

Where I work, we have been using Microsoft Virtualization since Virtual Server was in Beta.  Of course, we don’t necessarily use all of the functions and features of all the software we have, but one feature that I have used a good bit is the “Convert physical server” action in System Center Virtual Machine Manager.  Until recently, I have used this with great success.  We run IBM xSeries servers and I have converted something like 50 of them to virtual machines running on Hyper-V over the past several years. 

In late 2007, we bought our first IBM Blade Center (which I am very happy with) and with that move we also decided to do “boot from SAN” for all of our blades.  Just seemed to make sense that we wouldn’t put moving parts in a device that was designed to run so well without moving parts. 

At the time, we were implementing a new ERP system and several “hanger on” type applications, and Hyper-V (virtualization in general) wasn’t something that was supported by a lot of the software we were deploying.  So we have a lot of powerful blade servers, running a lot of low use applications.  I have managed to eradicate several of those wasteful installations, but there are a set that I am only now getting buy-in to virtualize. 

And today’s adventure begins with a Windows Server 2003 SP2 machine installed Boot from SAN on an IBM HS21-XM Blade server.

First attempt:

1.  Convert physical server

2.  Virtual machine name

3.  Scan System

image

Looks good..

4. Conversion options

image

we can try the defaults..

5.  Specify the processor and memory… 

6.  Select the host, path, network, start options, etc..

7.  The job starts, the machine gets copied over, and …

That try resulted in a blue screen loop.. 

image

Ok… time to try the Offline conversion:

1. Proceed as above but select the Offline conversion option at step 4.

2.  hmm..  conversion warnings… must correct to proceed..

Warning (13246)
No compatible drivers were identified for the device: Broadcom BCM5708S NetXtreme II GigE (NDIS VBD Client). The offline physical-to-virtual conversion requires a driver for this device.

Device Type: network adapter
Device Description: Broadcom BCM5708S NetXtreme II GigE (NDIS VBD Client)
Device Manufacturer: Broadcom Corporation
Hardware IDs (listed in order of preference):
B06BDRV\L2ND&PCI_16AC14E4&SUBSYS_03271014&REV_12

Compatible IDs (listed in order of preference):
B06BDRV\L2ND&PCI_16AC14E4&SUBSYS_03271014
B06BDRV\L2ND&PCI_16AC14E4
B06BDRV\L2ND

Recommended Action
Create a new folder under C:\Program Files\Microsoft System Center Virtual Machine Manager 2008 R2\Driver Import on the Virtual Machine Manager server and then copy the necessary 32-bit Windows Vista driver package files for this device to the new folder. The driver package files include the driver (.sys) and installation (.inf and .cat) files. Check the device manufacturer’s website for the necessary drivers.

We don’t really need to do that right…

Had some trouble with that part…  finally figured out that the drivers that need to be placed in that folder are the “RIS” drivers. 

Try number 3 (or 30, I lost count)…

1. Proceed as try number 2, ignore warning because we did put the driver in there, and

Blue screen loop…

Hmm… maybe this is just not meant to be.  Did some more searching and found this article:

http://blogs.msdn.com/b/robertvi/archive/2009/10/07/after-installing-hyper-v-integration-services-on-the-next-reboot-the-vm-displays-bsod-0x0000007b.aspx 

Basically, there are some people seeing the exact same blue screen that I was seeing, except this was after the install of updated integration components.  But I wasn’t installing integration components yet… or was I?

image

Ok so maybe it was getting that far and just “blowing up” after the install of the components.  Good thing about this being a P2V, I can go back to the source machine pretty easy and check the registry:

image

Looks like we may have an answer here.  Change the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wdf01000\Group entry to be WdfLoadGroup instead of base. 

It is my guess, that this would have worked even with the online conversion option.

A fatal error occurred while trying to sysprep the machine.

Today, while getting ready to deploy an updated Citrix farm for a set of Line of Business applications, I got an error during the sysprep process.  The machine in question is a 2008 64 bit machine.  It has Citrix and all the applications installed.  It is also a Hyper-V VM. 

I created an answer file and when I run Sysprep I get a popup that says:  A fatal error occurred while trying to sysprep the machine.

Hmm..  so I look at the logs and here is what I find:

2010-06-03 10:42:33, Error      [0x0f0085] SYSPRP LaunchDll:Could not load DLL drmv2clt.dll[gle=0x0000007e]
2010-06-03 10:42:33, Error      [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 126[gle=0x0000007e]
2010-06-03 10:42:33, Error      [0x0f00a8] SYSPRP WinMain:Hit failure while processing sysprep cleanup providers; hr = 0x8007007e[gle=0x0000007e]

I found lots of references to Windows Media Player, and that you can’t have sharing enabled.  Not a problem on this machine.  Not any help either. 

I did find this article helpful: http://myit4u.wordpress.com/2010/03/17/launchdll-could-not-load-dll-drmv2clt-dll/

Guess what?! Those aren’t shown in on a Windows Server 2008! Our workaround was to install the Desktop Experience feature on the server.

I added the “Desktop Experience” feature did the sysprep and then uninstalled it on each of the new machines.  Rather a pain, but I didn’t have a lot of time to work on figuring out a better answer.

My 5 seconds of fame…

So this week, I am at MMS 2010.  I try to come to MMS every year, because it gives me a chance to get away from the office (if not really away from work), and allows me to get some time to look at, learn about, and hopefully gain insight into what Microsoft is thinking about when they design the products I use, and the systems I maintain.  It is almost like a working vacation.  Away from the daily grind of my work life, I get to really let the inner geek out and get excited about the things that I enjoy in my job.

The opportunity to have conversations with the people that work on creating these products and people that use them in various environments is also very refreshing and useful.  This gets better over the years, because I have begun to recognize the people that have the answers I am looking for or the ideas that I can use. 

Last year, when I was at MMS, I happened to be standing too close to an area where they were conducting interviews… 

Today, while I was walking through the Expo, I saw someone that looked familiar, and he started talking to me before I even figured out where I recognized him.  He started talking about a video and how it had been talked about, and I was thinking “he obviously has me confused with someone else”.  Then I recognized who he was, and started getting nervous…

He opened up his laptop and showed me the a video called “What’s on your mind”.  It was evidently the intro video to one of the keynotes at TechEd last year.  I show up in a few spots, but mostly, I think, because they like my swimming pool analogy… 

Find me at 25 seconds through 30 seconds…

http://nukeitmike.com/video/whats%20on%20your%20mind.wmv

Thanks to Stephen Rose from Microsoft for remembering me and allowing me to post the video on my blog.

“netvsc” error in Hyper-V guest

We use Citrix Presentation Server for a number of applications, and lately we have had a significant increase in issues with one set of our Citrix servers.  We have 3 main sets of Citrix servers and the problems have only been happening on one set. 

One of the sets doesn’t have this error, but wouldn’t because they are physical servers.  They have been in production a long time, and we have plans to virtualize them. 

The second set doesn’t get the errors, but it is fewer servers and fewer users.

The third set:

    • is virtual
    • runs on 2008 R2 Hyper-V
    • has more servers (6 as opposed to 4 or 5 for the other two)
    • supports more users and more users per server (averages around 20 users per server during business hours)

Around November, we started upgrading our hosts from 2008 to 2008 R2.  The problems have been getting progressively worse peaking in the last 2 months.  Our last 2008 host was converted in March. 

After some event log review, we were able to correlate some of the issues to the following error in the event log:

Event Type:    Warning
Event Source:    netvsc
Event Category:    None
Event ID:    5
Date:        4/19/2010
Time:        3:49:53 PM
User:        N/A
Computer:    <ServerNameChangedToProtectTheGuilty>
Description:
The miniport ‘Microsoft Virtual Machine Bus Network Adapter #4′ hung.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 00 00 00 00 02 00 52 00   ……R.
0008: 00 00 00 00 05 00 00 80   …….€
0010: 00 00 00 00 00 00 00 00   ……..
0018: 00 00 00 00 00 00 00 00   ……..
0020: 00 00 00 00 00 00 00 00   ……..

and right behind that would be this message:

Event Type:    Information
Event Source:    netvsc
Event Category:    None
Event ID:    4
Date:        4/19/2010
Time:        3:49:53 PM
User:        N/A
Computer:    <ServerNameChangedToProtectTheGuilty>
Description:
The miniport ‘Microsoft Virtual Machine Bus Network Adapter #4′ reset.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 00 00 00 00 02 00 52 00   ……R.
0008: 00 00 00 00 04 00 00 40   …….@
0010: 00 00 00 00 00 00 00 00   ……..
0018: 00 00 00 00 00 00 00 00   ……..
0020: 00 00 00 00 00 00 00 00   ……..

After doing a bit of searching and getting a lot of nothing, and doing some on site troubleshooting without much luck, I finally broke down and called Microsoft.  I spent a day e-mailing back and forth with someone who was suggesting that I try all the things that I had already tried, so I contacted our TAM and had the case escalated. 

The technician then informed me that there was an internal hotfix that had not been fully tested yet, that related to my issue.  It seems that in 2008 R2 Hyper-V guests running Server 2003, the network adapter will hang and then reset under heavy load.  The hotfix has to be applied to the host and then the integration services on the guest have to be updated.  In my environment, when I updated, I had to remove the integration services from the guest before the updated NIC driver would install.  I reported this behavior to the technician I was working with, but he said that he couldn’t reproduce that particular problem and that he had no issues updating his test environment.

It is my understanding that the hotfix will be released under KB981836.  When you install this, it changes the integration services version from 6.1.7600.16385 to 6.1.7600.20683.  You can see this if you look at the driver version on the guest NIC.

The ordinal 120 could not be located in the dynamic link library iertutil.dll.

We have 5 Citrix Terminal Servers that are configured “identically”.  After installing IE8 on two of them, the following started showing up:

 

clip_image002[4]

 

After a bunch of searching, I saw a few people have gotten this, but no one had a solution, or at least I couldn’t find it.  I did see a similar message related to Adobe Reader, and that is what helped me find the answer to our problem.

One of the servers was not having the problem, but it DID have IE8.  hmmm..  It also had Adobe Reader 9 installed on it.  The others had Adobe Reader 8. 

So to fix the problem, required uninstalling IE8, updating to AR9, and then reinstalling IE8.  I did try just installing the updated Adobe Reader, but it still got the error until I uninstalled IE8. 

Not recognized as a cmdlet…

I have been working on a simple little script to copy a file and then launch a program.  I am sure that there are a lot of ways to do it, but I decided to use PowerShell, and this is what I came up with:

$CheckForFile = "H:\custom.ini"
$FileToCopy = "c:\IT\custom.ini"
$CopyFileTo = "H:\"

$PathTest = Test-Path $CheckForFile
If ($PathTest -eq "false")
    {
    Copy-Item $FileToCopy $CopyFileTo
    }

#uses the Invoke-Item command to launch the application
Invoke-Item "C:\Program Files\executable to launch.exe"

This is for use in a Citrix/Terminal Server environment, so I want to be able to call this script like this: PowerShell copythenlaunch.ps1

When I tested that, I got this:

C:\IT>powershell copythenlaunch.ps1
The term ‘copythenlaunch.ps1′ is not recognized as a cmdlet, function, operable
program, or script file. Verify the term and try again.
At line:1 char:18
+ copythenlaunch.ps1 <<<<

I kept thinking there was some problem with the install of PowerShell (I am running this particular script on a Windows 2003 Server) or that I had some illegal character in the name (it had a number in it originally) or some other simple problem.  Finally I did a search and came across this little bit of conversation:

re: Power and Pith

I just started with PowerShell.

Wanted to run some test scripts from you download.

When I tpye in Beep.ps1 I get "The term ‘Beep.1′ is not recognized….."

What Am I doing wrong?

Friday, December 29, 2006 3:17 PM by MikeL

# re: Power and Pith

> When I tpye in Beep.ps1 I get "The term ‘Beep.1′ is not recognized….."

> What Am I doing wrong?

You are relying upon a traditional bad shell behaviour that has been a security nightmere for decades.

In PowerShell, you have to be explicit if you want to run a command in the current directory.  Type ".\beep.ps1"

Jeffrey Snover [MSFT]

Windows PowerShell/MMC Architect

Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell

Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Friday, December 29, 2006 5:19 PM by PowerShellTeam

# re: Power and Pith

Thank You for supplying the ".\*" information.  I have been racking my brain for almost two days wondering what I was doing wrong.  And to think it was as simple as using the PROPER .\yourscripthere.ps1 format.

Thank you very very much

Ditto on the thanks…

Windows PowerShell Blog : Power and Pith

Ha Ha – “408 error”

For some reason this struck me as funny…  Got it when I went to view the WordPress stats for my blog…

image

PowerShell Confirm Preference

I seem to run into an issue when I run some PowerShell scripts where I get prompted at each line of the script for confirmation.  That can get really annoying, so I have to look up how to prevent that behavior.  Thankfully, there is already some good information out there on how to do that:

When confirmation is turned on by $ConfirmPreference, you can turn it off for any individual cmdlet invocation using "-Confirm:$false".  You can also use "-Confirm:$false" to turn off default confirmation for high impact cmdlets such as Removing a Mailbox.  Another way to turn off confirmation is by setting $ConfirmPreference to "None"; you can limit the effect by setting $script:ConfirmPreference etc, see "get-help about_scope" for more details.

For more details and options besides just turning it off, go see the original post:

Windows PowerShell Blog : ConfirmPreference