Skip to main content

Posts

Showing posts from 2015

Calculating Bitwise Values

In the last post, I went into a bit of what bitwise AND does, looked at the binary equivalent of the userAccountControl (UAC) value, and showed some visual examples of how calculations are done to find the applied flags.In this post, I thought I’d go through exactly how you do this. So first off, dust off your calculator and get into Programmer mode. Since Windows 10 has a beautiful calculator, I’ll be doing my demonstration on that.CONVERTING INTEGERS TO BINARY IN CALCULATORYou’ll cry when you see how easy this is.Make sure your calculator is set to DEC.Type in your value.Observe the BIN value.Done! When I copy and paste out of the calculator, I get ‭00010000001000000000‬.HOW ABOUT POWERSHELL?Well, sure. In this case, we can use the [convert] class to switch the value to base2 format. Check it out:[Convert]::ToString(66048, 2) This outputs the exact binary value I had before with the leading zeroes stripped off -- 10000001000000000. Note all I did was add my value 66048. As an aside, …

My Feeble Understanding of Bitwise

I thought I would set the record straight that by posting something about bitwise does not make me an authority. It doesn’t even make me mildly educated about the concept. In fact, if you have been with me since the beginning, you will know the intention of my blog to create posts that would serve as reminders of how I did something previously -- or interesting stuff that I might have found. With that meager attempt at excusing my ignorance, let’s talk bitwise.In my last post, I mentioned deciphering userAccountControl (UAC). As an aside, this bitwise stuff isn’t just AD. You can find it in other things like ConfigMgr for example. Remember advertFlags? That post contained some detail on decoding, bitwise, etc., as well.REFRESHERBack to our previous example, we had a user with UAC value of 66048. We decoded 66048 into its two parts, 65536 and 512. I didn’t go into much detail on how I got those two values, so I thought I’d explain all that here.First, a background on bitwise AND. Basic…

Deciphering userAccountControl

There’s been a lot of good information on userAccountControl (UAC) over the years. I was trying to explain a coworker about how it works which got me really thinking about it. I thought I’d try to share my findings with you in case you have a similar interest in learning it.WHAT IS USER ACCOUNT CONTROL?Let me first describe UAC. The simplest definition, in my opinion, would be to say that it’s a composite status of an object. (Let’s talk about user objects specifically.) A user object can be a variety of things -- disabled, enabled, locked, password expired, etc -- which when the integer value that’s stored in UAC is broken down, represents them. That’s why the account options are multi-select, I guess. :-)Note that UAC is a 32-bit value. Anyway, this is the LDAP attribute where Active Directory stores the various states of your user account. How many different states can a user account be in, you might be wondering? It’s documented in quite a few places, actually (and now here.)(Sorr…

OpsMgr: Where Are My Events?

Yeah. I know. We’re late to the party. We just got OpsMgr 2012 rolled out. If you want to skip the story time, just go to the TL;DR section.So, one of the first times I opened the console, I realized there were some events I was looking for that I wasn’t able to find. After carefully combing the console (read: frantically clicking on crap) I came to the realization that no matter which event view I chose, it was restricted to one day.After talking with one of my engineers, he suggested looking at this article http://www.opsman.co.za/how-to-search-for-more-then-500-objects-in-the-scom-console-group-and-report-add-objects-fields which seems to be referring to searching objects. It did, however, lead to a very useful registry key:HKEY_CURRENT_USER\Software\Microsoft\Microsoft Operations Manager\3.0\Console\ConsoleUserSettings I don’t know what most of these settings do and quite frankly don’t want to figure it out. There are, however, two registry values of particular interest:AlertViewTi…

how to retrieve your ip address with powershell...

update: here is a new method using system.net.dns as noted here:[system.net.dns]::gethostaddresses("").ipaddresstostring update: this is how it’s performed in powershell v3 as demonstrated here.(get-netadapter | get-netipaddress | ? addressfamily -eq'IPv4').ipaddress update: this is by far the easiest.PS C:\temp> (gwmi Win32_NetworkAdapterConfiguration | ? { $_.IPAddress -ne $null }).ipaddress
192.168.1.101
are you laughing yet?  i know you probably find this topic amusing.  it's really interesting though.  whenever you get over it, i'll do this in the standard cmd.exe interpreter and then in powershell to show you what kind of coolness powershell does.done?  okay, good.  this is an interpretation of a demo that bob wells did at our smug meeting.  hope you like it.i should tell you, it's not as simple as the title would lead you to believe.  i like doing that little slight-of-hand thing since it gives the impression that i'm painting a very easy target…

Atlanta TechStravaganza 08.21.2015

Hey everyone!If you haven’t heard the news, we are holding another Atlanta TechStravanganza event this year. Once again, the event will be held at the Georgia Tech conference center here in the heart of Atlanta.Mark Minasi is heading down to kick it off as our keynote speaker. Pretty awesome right? We’re running three tracks (System Center, PowerShell, and Infrastructure) full of great content. On top of that, Tommy will be hanging around running a lab if you want to get some hands-on experience.Your ticket also includes meals, entry into prize giveaways, and plenty of networking opportunity. Cost? FREE! Because we work with generous companies that love to support the community, this event never costs you a penny.Ready to sign up? You should probably hurry. Half of the tickets are already gone. Head on over to our brand new site at http://atltechstravaganza.com. Hope to see you there! 37 days left!

Bind Response: InvalidCredentials

Sometimes I get the strangest things that come across my desk. As a manager, I don’t have a lot of time for troubleshooting so when I do get ahold of something, it’s fun to tear apart. I told my team about my findings. One of them asked how I arrived at the answer… so I thought I’d blog it just in case it interests anyone else.As a favor to a coworker, I looked into an application configuration problem that was described as such:Application is configured for LDAP.All users can successfully log into the application except one person.This one person is also the administrator of the application.The app owner indicated they were seeing timeout errors in their logs. There was no denying it. The call was timing out:Servlet.service() for servlet dispatcher threw exception javax.naming.NamingException: LDAP response read timed out, timeout used:-1ms.; remaining name '' at com.sun.jndi.ldap.Connection.readReply(Connection.java:483) at com.sun.jndi.ldap.L…

Embedding Expressions in Select-Objects

I had my first taste of using Select-Objects in a way more than just modifying values on output or to specifically pick a set of attributes to list. When someone asks for a list of users and their managers, meh, no big deal. When they ask for the user, their manager, and their manager’s email address -- well, no big deal but not as much of a no big deal as the first one.I found it a bit annoying that I had to write a script to do this every time I wanted to get this type of information so I did a bit of exploring. Turned out a little while ago, while experimenting in optimizing speed in a script, I had tried a method of using Select-Object to create a custom object.Using Select-Object to Pull Manager Detail on the Fly$myData | select @{n='UserId';e={$_.samaccountname}}, @{n='Created';e={$_.lastlogon}}, @{n='Name';e={$_.name}}, @{n='Manager';e={$_.manager}}, @{n='Manager Email';e={ (get-aduser $_.manager -properties mai…

DHCP Scope Information

Thought I’d squeeze in this post before Windows Server 2003 drifts off into the sunset. (Don’t pretend like you don’t have these servers floating around.)Okay, so, I was recently asked to validate that some DHCP scope work was performed correctly. Validation in this case was to pull all the scope options. It would have been immensely helpful to use PowerShell to do this. However, I made do without it using Netsh.Retrieving Scope Options for a Single Scopenetsh dhcp server <servername> scope <scopeaddr> show optionvalue That’s easy. How about for every scope on my server? That’s easy, too, as it turns out.Retrieving Scope Options for All Scopesfor /f %a in ('netsh dhcp server <servername> show scope ^| find /i "."' ) do @netsh dhcp server <servername> scope %a show optionvalue

PowerShell: Updating Terminal Services Profile Information

If you’ve done any dabbling in the AD cmdlets and attempted to update terminal services information, you’ll hit a wall with the traditional cmdlets. Why? Well, simply, what you see in AD Users and Computers is not the way the values are actually stored, as Ed explains.Well, luckily, it turns out it’s not that hard. I was asked to come up with a process to update the profile path. This is a sample of what I ended up with:$PathValue = <myUserPath>
$myUser = "myUserName" $User = [ADSI]LDAP://$((Get-AdUser $myUser).distinguishedname) $User.psbase.invokeset("TerminalServicesProfilePath",$PathValue) $User.setinfo()Back to the Scripting Guys’ script, here is a function that shows the possible values that can be modified:function SetTSProperties() { $ou = [adsi]"LDAP://ou=mytestou,dc=nwtraders,dc=com" $user = $ou.psbase.get_children().find($userDN) $user.psbase.invokeSet("allowLogon",1) $user.psbase.invokeSet("TerminalServicesHomeDirector…

PowerShell: Static Methods

Thanks PowerShell.com for the “Useful Static .NET Methods” PowerTip of the Day. Read the article.Find all static methods.[net.dns] | gm -MemberType *method -static Find all signatures (overload definitions).[net.dns]::GetHostByAddress One last thing, if you’re looking for a good reference list of static methods that are useful, pick up a copy of Windows PowerShell Cookbook, 3rd Edition, by Lee Holmes.

Importing a RSA Token on Windows Phone

I recently (this morning) had the good fortune of having to recover my Windows Phone. I run a Lumia 920. It’s been rock solid but recently have had stability issues. It kept locking up and rebooting itself randomly. This morning, it locked up. I rebooted it, and it locked up again. Finally, I rebooted it once more and got the light blue screen of death with the frowny face.While thinking about all of the apps I would have to go in and configure, the one I dreaded most was getting my RSA token reconfigured. Why? I didn’t bother to write down the steps the last time I went through it. Now, I will remedy that problem.Here we go.Get the RSA SecurID app from the Windows Phone Store HERE.The next thing you need to do is to install the RSA SecurID Software Token Converter. (All you really need is the TokenConverter.jar file.)Next, however you do it, request a token.Once you got the token, put the token (usually ends in .stdid) and the TokenConverter.jar file into the same directory.Next, ope…

Enabling the Windows 10 Calendar

Are you running the Windows 10 Technical Preview yet? If so, here’s a little refresh for the new calendar. The problem is, you might need to hack your registry to get it to show up.Does your calendar look like this?Try the registry hack to get it to look like this:Here’s the hack:Open the Registry Editor (regedit).Head to this path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShellCreate a new DWORD (32-bit) Value entry.Name it UseWin32TrayClockExperience.That’s it!Try click on the clock on your taskbar. You should now see the refreshed calendar. :)

Jump to Conclusions About Leap Seconds

What a better way to start off the new year than to write about the leap second. According to Wikipedia, the leap second system, designed to adjust for “irregularities in the Earth’s rate of rotation”, was introduced in 1972. Since that point, 25 leap seconds have been inserted to adjust the atomic time. Most recently, it occurred on June 30, 2012 at 23:59:60 UTC. That’s right. A leap second is displayed as :60.Since time is the topic today, I was reading a blog post on this event as it pertains to Windows this morning and thought I’d share a few interesting points and observations:In KB 909614 How the Windows Time service treats a leap second, the article seems to indicate that the Windows Time service does not do anything with the leap indicator. During this point, the NTP client will be a second faster than the atomic time which is resolved at the next time sync. The wording is a little confusing to decipher in my opinion.Most applications cannot handle leap seconds since the time …

Top 20 of 2014