Learn about Windows PowerShell
In this post:
How Do I Set Indexes in AD DS or AD LDS?
Hey, Scripting Guy! I have a need to run approximately three million queries a day against an Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) instance from SQL. I can appreciate that indexes improve the performance of queries.
My question is how do I set indexes in AD DS or AD LDS? Bing searches talks about it being done, but I can’t find how to do it. Any guidance you could provide would be appreciated.
I do not think you can actually set the indexes for AD DS. But in the Active Directory Schema tool, double-click the AD DS attribute you need to index, and in the only tab shown, you will see two check boxes that will help. The first is Index this Attribute, and the second is replicating the attribute to global catalog.
Because global catalog servers are optimized for search replication, replicating the attribute to the global catalog should help. Be aware that such a move will trigger a replication event, so be careful when you make the change.
By the way, to register the Active Directory Schema tool, you must register schmmgmt.dll. Use RegSvr32 from an elevated command prompt or Windows PowerShell console. If you do not run it elevated, you will see a message saying that the DLL was loaded but that the call failed with 0x80040201. If you search for that error code, there are lots of hits but none of the hits will tell you that you need to run the command from an elevated session. After you have the Active Directory Schema tool, select the attribute you are interested in modifying, and make the changes. As seen in in the following image, there are several options from which to choose.
How Do I Remove Windows PowerShell 1.0?
Hey, Scripting Guy! Please point me to instructions for removing Windows PowerShell 1.0 from Windows XP Professional so that I can install Windows PowerShell 2.0. I have read that service packs can remove the Windows PowerShell 1.0 uninstaller. Is the Windows XP Professional uninstaller for Windows PowerShell 1.0 available for download?
The support article at http://support.microsoft.com/kb/926139/ does not include instructions for removing Windows PowerShell 1.0 from my Windows XP Professional system. In Currently installed programs, Windows PowerShell 1.0 does not appear on my Windows XP Professional system and consequently I am unable to click Remove.
You can install the RTM version of Windows PowerShell 2.0 directly over Windows PowerShell 1.0. You do not need to remove the old version. The remove and reinstallation requirements you may see referenced on the Internet are all artifacts left over from the beta version. You can get the final version of Windows PowerShell 2.0 from http://bit.ly/31P7hP.
After you perform the installation, you may be curious about whether the upgrade actually worked, especially because Windows PowerShell will still reside in the C:\Windows\System32\WindowsPowerShell\v1.0 directory. You can confirm that the upgrade was successful by opening the Windows PowerShell prompt and querying the value of the $PSVersionTable variable. You should see something like the following displayed:
Please Help Me Troubleshoot This VBScript Script!
Hey, Scripting Guy! I have written a VBScript to query the Win32_NetworkLoginProfile class and return information about who has logged on to the device. The script works fine, but the value pulled back from NumberOfLogons seems to be inconsistent. If I run this on a computer onto which a user has only logged on once, I get a return value of “143”; if I then log off and log back on, it increments to “144”.
Does any anyone have any ideas about why this is the case or can point me in the right direction to resolve this? The code being used is shown here:
This is from the SDK on MSDN:
Data type: uint32
Access type: Read-only
Number of successful times the user tried to log on to this account. A value of 0xFFFFFFFF indicates that the value is unknown. This property is maintained separately on each backup domain controller (BDC) in the domain. To get an accurate value, only the largest value from all BDCs should be used.
Can I Get an Offline Copy of All Exchange 2010 Articles on TechNet?
Hey, Scripting Guy! I just wanted to say the 2010 Scripting Games were a lot of fun. Last year, I just spectated because I just started using Windows PowerShell the week before. This year, I did mostly beginner-level scripts because I was busy at work! Anyway, I had a question that you might be able to answer. I look forward to next year’s Scripting Games. Tell the Scripting Wife I'm very impressed with how well she did!
What I am wondering is if there is a way to get an offline copy of all the Exchange 2010 articles on TechNet so that I have something productive to do on long plane flights.
I have looked around, and I do not see a way to do this from a script. I’m not saying it cannot be done; I just cannot find a method to do it. I looked at the internetexplorer.application object as well as the net.webclient class.
Many years ago, I used to have a small program I had purchased that would make an offline copy of a website. You could even specify how many levels deep you wanted it to go, and whether or not to cache pictures and chase links. It was a pretty cool program. As Internet speeds picked up, and as the number of websites I frequented expanded, I ceased to use the program. Now I cannot even remember its name. You may wish to check for offline browsing software and see if you can find something. You may also find a cool script that does this; if so, let me know.
In addition, I used to have a subscription to TechNet. It came on CD-ROMs back then and contained awesome articles and videos. They still make the DVD ISOs available from the TechNet subscriptions site, so if you have a subscription, that would be cool to copy the ISOs to your computer. Just make sure you have an ISO reader, or a way to mount the ISO as a CD/DVD.
I have flown to Malaysia, to Hong Kong, and to Australia several times, and I know they are extremely long flights from the United States. I think the flight to Hong Kong was about 22 hours, so having something productive to do is a great idea. I used to get TONS of work done on airplanes because they are so boring and offer very little in the way of distractions.
I am glad you enjoyed this year’s Scripting Games. This really makes me happy because I worked hard designing all the events. By the way, we have announced the 2011 Scripting Games already, so put it on your calendar. The announcement is here: http://blogs.technet.com/heyscriptingguy/archive/2010/05/07/psssst-wanna-know-the-dates-for-the-2011-scripting-games.aspx
Well, this concludes another edition of Quick-Hits Friday. Join us tomorrow for the Weekend Scripter as we delve into the mysteries of…well, we will let that remain a mystery for now.
If you want to know exactly what we will be looking at tomorrow, follow us on Twitter or Facebook. If you have any questions, send e-mail to us at firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson and Craig Liebendorfer, Scripting Guys