Mar 27, 2015

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 Scope

netsh 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 Scopes
for /f %a in ('netsh dhcp server <servername> show scope ^| find /i "."' ) do @netsh dhcp server <servername> scope %a show optionvalue

Mar 26, 2015

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("TerminalServicesHomeDirectory",$hDirValue)
 $user.psbase.invokeSet("TerminalServicesProfilePath",$ppValue)
 $user.psbase.invokeSet("TerminalServicesHomeDrive",$hdValue)
 $user.setinfo() 
} #end SetTSProperties

Feb 9, 2015

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.

Feb 3, 2015

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, open a command prompt and navigate to the directory you put the files in.
  • Type the following command:

java.exe -jar TokenConverter.jar .\myToken.sdtid -winphone -o .\myFile.txt

  • If this fails, your administrator might have established a password on the token. Add the password using the -p switch and run the command again.
  • Upon success, the myFile.txt will contain the path you need for your RSA SecurID app. The file contents will look something like this:

com.rsa.securid://ctf?ctfData=longstringofnumbers

Grab that path. You’re going to need it for your app. All you have to do now is open the app and put the path in there.

Hit the checkbox. You’re good to go.

Jan 26, 2015

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?

image

 

Try the registry hack to get it to look like this:

image

 

Here’s the hack:

  • Open the Registry Editor (regedit).
  • Head to this path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell
  • Create a new DWORD (32-bit) Value entry.
  • Name it UseWin32TrayClockExperience.

image

 

That’s it!

Try click on the clock on your taskbar. You should now see the refreshed calendar. :)