Monthly Archives: April 2014

NPM behind an authenticated proxy

Playing around with npm (Node Package Manager?) needs a little bit of configuration if you are behind an authenticated corpoate proxy. I found myself in this situation while playing with npm at work for the first time. While trying to install some module, npm has shown the following message hinting that proxy configuration is not set.

Image

To resolve this issue, simply configure http/https proxy settings with npm config command

npm config set proxy http://Username:Pa55w0rd@proxyhostname
npm config set https-proxy http://Username:Pa55w0rd@proxyhostname

Being behind an authenticated proxy in a corporate environment increases the probability that you have a very strong password enforced by your IS department. If you have special chars in your password, enclose your Username:Password pair in double quotes as shown in the example below.

npm config set proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com
npm config set https-proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com

Finally if you wish to verify if the settings are active, verify it by issuing the command

npm config ls *proxy

Image

Advertisements

Edit PDF documents – Windows 8.1 and Adobe Reader XI

Working in an IT field sometimes, opens your eyes towards a few smart things some brainy users find out. Recently I happened to find out a very interesting work around from a user in my organization. The HR department had asked all our employees to enroll in an HR related campaign and had circulated an application form, which was a PDF document.

All of us including the belittled us in the IT :), had printed out the application form and filled and submitted the handwritten forms to the HR Department. One smart user, had sent his application form in an email to the HR Dept. The person in charge contacted me and told me that they had received the only one application form that was typed and not hand written. This got me curious and I had contacted the user to know from him and how he had achieved this. Following are the steps:

1-      Open any PDF Document, assuming the PDF Document to be an Application form.

2-      Click on “Sign” on the top right hand side of the document. This should be on the top right end of the tool bar.

Image

3-      Upon clicking “Sign” you are presented with a few options

Image

4-      Click on Add Text and then click on that section of the document where you may have to fill in your personal details. A blinking cursor appears and you may just continue typing in all that you need.

5-      The same can be done with “Checkmark” too. Just that a tick mark is the only option available.

I was so surprised at the ease at which the user explained this to me. The enlightenment I had on knowing something that none of us could think of, that moment. I bet you get that feeling only when you work in a support role. But again, where you are required to hand fill an application form, please do so ;).

PS: I’m assuming this to be working with only Windows 8.1 and Adobe Reader XI. I have a feeling that this will definitely work with Windows 8 and Windows 7 too but I feel Adobe Reader XI is a must. If any of you find this to be working with another version of Adobe Reader, please do let us know.

Android SDK Manager Failing to Load

Android SDK Manager wont open

It’s always a pain in the <you-know-where> when you lose your hard disk to time. Some must be frowning at this statement asking ‘What’s the big deal in this cloud era?’. Well some or most of the data may be somewhere in the skies but getting everything back and setting up one’s development environment to whereever she was, is a real pain as what happened to me few weeks back when I lost my good old HP laptop.

So, I was setting up my Android developement environment on my new laptop with latest available ADT bundle and JDK. But when trying to launch the SDK Manager it was just failing to load and never left a trace of what went wrong. In my case the problem turned out that ADT was unable to locate the private JDK installation. To diagnose, the first thing you can do is to launch a command window, type set JAVA_HOME there, press return key and see if it prints out any directory locations. If it doesn’t, Bingo, thats the deal.

Now, to fix this issue there are two ways, pick the one that suits your level of hackerdome.

  • Option 1 : Set up your JAVA_HOME environment variable from Control Panel > System  and launch SDK Manager (Refer to screenshot below)

env-config

  • Option 2: Modify<sdk-root>\tools\android.bat to point to the required JDK/JRE location as shown below
    • (Here be dragons: Try this only if you have some clue to on how batch files work)
    • Locate the line that says “set java_exe” , assign the path to java.exe,  comment out the next two lines as shown below, save the file and then try launching SDK Manager

android-bat-update

 

TL;DR: Android SDK Manager fails to start without showing any error messages and with possible one single blink of a black window? The ADT has no clue where to locate JDK/JRE on your PC. Either fix your PATH variable to point to a JDK/JRE location or edit <sdk-root>\sdk\tools\android.bat file in the next line where you see the comment ‘Check we have a valid Java.exe in the path’

Windows cannot be installed to this disk, the selected disk is of the GPT partition style

Applies to Installation of Windows 8 / 8.1 on Machines running Windows 7 or Vista Previously

  1. Boot using the Installation Disc
  2. Click Install but do not continue ahead.
  3. Press SHIFT-F10 to bring up the console
  4. Type “diskpart”
  5. Once within the diskpart prompt
    • Type: list disk
    • Type : select disk <number> (the number of the disk you wish to convert)
    • Type: clean (to remove any existing configuration settings on the drive)
    • Type convert to mbr

 Apologies for the poor screenshots 🙂

Windows8Installation

 

DiskpartConsole

2014-04-21 15.39.21

Get-WmiObject : The RPC Server is unavailable

Error Message when running Get-WmiObject cmdlet on a Remote Machine

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:1
+ Get-WmiObject win32_bios -ComputerName remotecomputername|Select PSComputerName,Manufact ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
 + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand


Verify DCOM Settings on Remote Machine

  • The first step is to check is if the DCOM Service is enabled in the Remote Machine
    • From the remote machine; From the Start Menu; type dcomcnfg
    • Open Computers – Right Click My Computer – Properties
    • If the checkbox for ‘Enable Distributed COM on this computer ‘ is ticked; you have got through the first step. By default this option is always enabled

DCOM_Settings

 

Check the Windows Firewall on Remote Machine

  • The next step is to check Windows Firewall. It is most likely that your firewall is enabled.
  • For testing purposes, please disable the Firewall on the remote machine and test the script. I’m sure you have got the result. If not, I would sadly request you to look for answers elsewhere 😦
  • It is not advisable to disable your Firewall to get this working and most of all if you are administering a network of over 100 or 1000 machines this is not practical either. So the best way is to identify the Communication Port that was blocked when running the script. So turn back your Firewall On.

Enabling Logging on Windows Firewall and Identify Blocked Port on Remote Machine

  • From Advanced Settings of your Firewall; right click Windows Firewall with Advanced Security on Local Computer and select Properties
  • From the Domain Profile Tab; click Customize under Logging
  • Select the Yes drop-down for Log dropped packets
  • Take note of the Logfile Location and filename from the name field
  • Click Ok to confirm

Enable_Firewall_Logging

 

  • From your PC or a Server PC; run the Get-WmiObject cmdlet once again so as to receive the error
  • From the remote machine; run Notepad as Administrator and open the pfirewall.log file
  • Identify the Drop Action from the Firewall that points to the time we ran the Get-WmiObject cmdlet and the source-ip (src-ip) of the machine you ran the script from
  • Take note of the Protocol TCP/UDP and Destination Port Number (dst-port) Eg: 49155
  • You can enable an Inbound Rule for this your problem will solved. If you are administering a large network; apply this to a group policy instead.

Inbound_Rule

Unable to open Windows Firewall Logfile pfirewall.log – Access is denied

  • Open Notepad using Run as Administrator
  • Open the logfile from Notepad

Smart Phones Tutorial | Tablets Tutorial

Video Tutorials are definitely a great thing and very interactive indeed. But I stumbled upon a site; which has no Video Tutorials but yet by far the best Tutorial Site for Smart Phones and Tablets that I have ever come across

They have tutorials across all well known brands; Alcatel / Apple / AudioVox / Blackberry / Ericssion / HTC / Huawei / Kyocera / LG / Motorola / Netgear / Nokia / Novatel / Pagers / Palm / Samsung / Sanyo / Sierra Wireless / Sonim / Sony and more

 

Below are links to a few popular ones

Tutorial for IPhone 5s

Tutorial for IPhone 5c

Tutorial for IPhone 4s

Tutorial for IPad Air

Tutorial for IPad Mini

Tutorial for Samsung Galaxy S5

Tutorial for Samsung Galaxy S4

Tutorial for Samsung Galaxy Note 3

Tutorial for Blackberry Z30

Unable to Install Windows Management Framework 3 on Windows 2008 SP2 Server

Are you getting the below error when installing Windows Management Framework 3 on your Windows 2008 SP2 Server?

Update_Not_Applicableu

 

Well, all you need to verify is the current version of your .NET Framework.  To verify the current version; proceed to the registry

HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP

The branch is most likely only upto V3 or V3.5

Download and Install .NET Framework 4 and your system will be ready to Install the Windows Management Framework 3

You may also find below post useful

http://www.happysysadm.com/2012/06/upgrading-to-powershell-30-on-windows.html

 

Write-EventLog The source name does not exist on computer

Write-EventLog : The source name “” does not exist on computer “”

If you have received this error using Powershell when trying to Write to the Event Log; it’s because you have not registered the source yet

Use the New-EventLog cmdlet to register the source prior to writing to the event log

New-EventLog -LogName Application -Source <Sourcename>

Using netsh command to extract dhcp client list

Applies to Windows Server 2008 and above

Please note that in future versions of Windows, Microsoft might remove the Netsh Functionality for DHCP Server. The recommended usage is with Windows Powershell. We will explore that in a later post.

In this example I have considered DHCP Server as \\mydhcpservername and scope as 192.168.0.0

Run Command Prompt

c:\>netsh
netsh>dhcp
netsh dhcp>server
netsh dhcp server>\\mydhcpservername
netsh dhcp server>show scope 192.168.0.0

Changed the Current Scope Context to 192.168.0.0 Scope

netsh dhcp server scope>show client 1

The above command will list the following in the below order

  • IP Address
  • Subnet Mask
  • MAC Address
  • Lease Expiry
  • Type of Lease
  • Name of Connected Device