Remotely Reboot Windows from Command Line

Here’s how we do it from the command line. Should work from PowerShell too.

  1. Win+R
  2. Type shutdown /[r|s] /m \\ComputerName /c “Comment” /d [u|p] <xx>:<yy> and then press ENTER.
Value Description
/r Restarts the remote computer.
/s Shuts down the remote computer.
/m \\ ComputerName Specifies the destination computer.
/c “ Comment Enables you to comment in detail about the reason for the shutdown. You can use a maximum of 511 characters. Comments must be enclosed in quotation marks.
/d [u|p] xx : yy Lists the reason for the system restart or shutdown, where xx specifies a major reason number from 0 through 255, and yy specifies a minor reason number from 0 through 65,535.
/force Forces the computer to shut down if other users are logged in. If this is not used and other users are logged in to the remote computer, the computer will not shut down or restart.

ImportantImportant
If you force the computer to shut down or restart, logged in users will not have the opportunity to save their work.
/t xxx Sets the time-out period before the system shuts down or restarts to xxx seconds. The valid range is 0-600, with a default of 30. Using the /t flag implies the /force option.

For more detailed information about the shutdown command and additional options, type shutdown /? at the command prompt.

Factory Reset Motorola/Symbol WLAN WS5000/WS5100 Switch/Controller

If you loose the administrator password for the Motorola/Symbol Wireless LAN Switch (WS5000 or WS5100) you can factory default the configuration and administrator password with the following procedure.

You’ll need to access the physical DB-9 serial console with a null serial cable. I found the defaults to work at 19200-8-N-1.

Once plugged in you’ll need to login to the console as the username “restore” with the password of “restoreDefaultPassword”. Here’s an example;

WS5100 login: cli

User Access Verification

Username: restore
Password: restoreDefaultPasword

WARNING: This will wipe out the configuration (except license key) and
user data under "flash:/" and reboot the device
Do you want to continue? (y/n): y

After the switch reboots you’ll need to use the default administrator username and password to log into the switch. They are username “admin” and password “Symbol”. Im my case it was admin/symbol but it could be admin/motorola.

Once this is done you can logon via serial using the cli user and then admin/which ever password worked and setup the switch.

Note that due to the age of these, web management cannot be done via https. You’ll need to load an old version of java and connect via http. I’ll try to cover that in another article.

If you’re good at the command line you’re set.

Multimedia Library Server

I’ve always used iTunes to manage my sharing and remote playing of my media library within my home.

As you no doubt know, iTunes sucks at sharing/streaming media. I used iTunes because it was the path of least resistance despite all the verbal abuse I’ve hurled at it…it’s bloated, slow, crashes etc…but that’s a whole different article…. 😉

Enter Plex. My Padawan at work turned me on to the Plex Media Server and my media consumption has been upgraded beyond my wildest imagination.

Continue reading “Multimedia Library Server”

Allow Root to SSH for Ubuntu

This is the most insecure thing you can do to your linux system. That said however, when working on development systems at home I like to logon as SSH. Granted this is behind a firewall to a linux system with no access from the internet.

This was tested on Ubuntu 14.x on a Raspberry Pi.

I do this out of laziness. NEVER do this to an internet accessible system.

Continue reading “Allow Root to SSH for Ubuntu”

Outlook 2011 For Mac Keeps Changing the Exchange Server Address

To update your Exchange 2007 or 2010 server you will need to run the following commands from the Exchange Management Shell and replace the Server running the Client Access Role with your external domain name. These commands update the URL for the Autodiscover service, Exchange Web Services (EWS) and the OWA Web-based Offline Address book respectively.

Before running these commands you will need to check make sure a DNS record exists mapping the IP Address to the Exchange Client Access (CAS) server.

Note: Each of these commands below should be run on a single line in the Exchange Management Shell (EMS):

Set-ClientAccessServer -Identity HostName -AutodiscoverServiceInternalUri https://mail.yourdomain.com/autodiscover/autodiscover.xmlSet-WebServicesVirtualDirectory -Identity "HostName\EWS (Default Web Site)" -InternalUrl https://mail.yourdomain.com/ews/exchange.asmxSet-OABVirtualDirectory -Identity "HostName\oab (Default Web Site)" -InternalUrl https://mail.yourdomain.com/oab

Recycle the IIS Application Pools

Next to make these commands take effect you have to tell IIS to push these changes by recycling the application pools.

  1. Open IIS Manager by clicking Start, then enter inetmgr.
  2. Expand the server and expand Application Pools, then right-click on MSExchangeAutodiscoverAppPool, and select Recycle.

Force Active Directory Sync/Replication With All Partners

From time to time I need to force sync all of my GCs aka DCs. This is a quick way to force everyone to replicate. If you have a lot of GCs this could take a while.

Syntax:
 repadmin /replicate destination_dsa Naming Context /allsources
Example:
 repadmin /replicate server1.test.com dc=test,dc=com /allsources

Destination server Name: server2.test.com
Naming Context: dc=test,dc=com (Domain partition)

How To Add TRIM Support on your Mac SSD

It is possible to do this by hand using the Terminal. It looks ugly but essentially what you’re doing is patching a low-level system file to allow TRIM to function with your SSD.

Just to be on the safe side, back up the file we’re modifying. Copy the following into a new Terminal window and hit Return (the Enter key).

sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original

You’ll be prompted to enter your administrative password, so type it in and press Return once more.

Use the following command to modify the kernel extension so that it activates TRIM support.

sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
Important: This code is intended for use on OS X Mountain Lion 10.8.5 or above or OS X Mavericks.

To make the changes take effect, you need to manually refresh the kernel extension cache.

sudo touch /System/Library/Extensions/

Once done, reboot and TRIM should be active.

How To Force SharePoint to Sync with Active Directory

Occasionally I have a user that changes their last name (or we got it spelled wrong) and I need the change to reflect across SharePoint (why SP doesn’t do this by itself I have no idea). In order to aid this process I found this script to force a resynchronize of each instance of the user profile in the user information lists. The script accepts one argument, which is the username to resync in the format DOMAN\User. Create a new powershell file with a ps1 extension and paste the code below into it.

$webapps = Get-SPWebApplication
 foreach ($webapp in $webapps) {
 [string] $login = $args[0]
 $sites = get-spsite -Limit All -WebApplication $webapp
 foreach ($s in $sites) {
 write-host $s.url
 $w = $s.RootWeb;
 $u = get-SPUser -Web $w -limit all | Where-Object {$_.userlogin -eq $login}
 if ($u -ne $null) {
 write-host "`t$($w.url)"
 Set-SPUser $u -SyncFromAD
 write-host "`tUpdated"
 }
 }
 }

After running it, you may get a few errors but you’ll notice their display name and other info is updated.