Wednesday, March 19, 2014

Expand a Basic Drive with Dell ExtPart

Last night I was assigned the task of expanding the C: drive on a Windows Server 2003 virtual machine. But wait, when I right click on the C: drive within Disk Management I'm not seeing the option 'Expand Drive'....


What to do now...


First we must Increase the virtual machines c: drive space from within VMware.

Right click the VM > Click 'Edit Settings' > Increase the size to the size you would like to expand the drive to.
From the computer you are expanding the drive on you can open a PowerShell prompt and type:
"rescan" | diskpart 
which will in turn pipe the Diskpart command(rescan) into Diskpart. Pretty neat huh?

 Now you should be able to see the unallocated space that you just assigned to this computer in VMware. 

Now for the really fun part..

Since this C: drive is a basic disk we won't be able to expand this drive via the GUI or with Diskpart(Diskpart cannot expand C: drives)
Download and save the Dell Extpart utiltiy to a location of your choosing (I always choose C:\Dell\ExtPart\).
1. Open an elevated command prompt > browse to the extpart.exe location . In my case C:\Dell\ExtPart by typing "cd c:\dell\extpart\". Now hit 'Enter' and type "extpart.exe".


2. Type the Drive letter which you want to extend and then the number of MB's you would like to add
C: <MB to expand drive by>
which will expand the drive specified by 60 GB.



3. Now specify how many MB you would like to expand your C: drive by. We have 60 GB of unallocated space so I specified  61440 MB which will hopefully consume all of the unallocated space..
The drive has now been extended and is showing a new volume size of 81981 MB! 








Looks like we have 16 MB hanging around yet...
That's easy, follow the same steps as above only this time there shouldn't be much math involved, just run the command:

extpart.exe c: 16


Boom, our C: drive has been successfully expanded!!

SystemName Drive Size (GB) FreeSpace (GB) PercentFree
---------- ----- --------- -------------- -----------
COMPUTERNAME C:    80.0      61.6           77.06 %

Friday, February 21, 2014

How PowerShell helps me make $100+ a month

Just like Gold and other precious medals, Bitcoin and Litecoin are obtained through a process called mining. Mining for litecoins however does not require any ground to be moved.

The best one line description to explain what a litecoin mining is:
"It's kind of like rounding up the world's greatest minds and making them do Sudokus for nickels."


Litecoin mining is simply configuring you computer to solve algorithmic equations, the beefier the computer's CPU or GPU is the more Kh/s you will receive from that device. As of today, not many people even bother mining with a CPU because a top of the line CPU will only give you around 10 Kh/s where my AMD R9 280X will output about 725 Kh/s. With that being said I was able to pay of my new GPU in about 3 months of mining.


However there are some costs and risks to mining;
  • Mining Hardware is pretty expensive.
  • Mining is like slowly earning a stock in litecoin(LTC).
  • The market could crash any day.
  • Everything earned can be lost
  • Hardware failure can occur


The Script

Below is the little script or function I wrote that configures my miner to specific settings. This could easily all fit on a few lines however I like to use the back-tick(`) with this script to make it really easy to find the configuration item that I'd like to adjust.

function GOLD_Digger {
<#
.CREATED BY:
    Matthew A. Kerfoot
.CREATED ON:
    2/21/2014
.SYNOPSIS
    Mines Litecoins from ltcrabbit at ~750KH/s
.DESCRIPTION
    Mines litecoins from `
    "https://www.ltcrabbit.com/#afnijl"`
    full link is needed to create first`    account.
#>
[CmdletBinding(SupportsShouldProcess=$True)]
         param(
               [Parameter(Mandatory=$false,
               ValueFromPipeline=$true)]
               [string]$FilePath = "C:\Users\Matthew\Desktop\`
CGMiner-LTCRabbit-V1\CGMiner LTCRabbit V1\cgminer-3.7.2-windows\",
               [string]$miner_path = "C:\Users\Matthew\Desktop\`
Powershell\Script_Repository\CGWatcher-1.3.4\mining.conf"
              )

setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_USE_SYNC_OBJECTS 1

Set-Location $FilePath
.\cgminer.exe -o stratum+tcp://us2.ltcrabbit.com:3334 `
              -u mkerfoot.worker2 `
              -p password `
              -w 384 `
              -I 13 `
              -g 2 `
        --gpu-powertune 13 `
        --temp-hysteresis 3 `
        --lookup-gap 2 `
        --shares 0 `
        --thread-concurrency 8191 `
        --gpu-engine 1050 `
        --gpu-memclock 1500 `
        --queue 0 `
        --expiry 1 `
        --scan-time 1 `
        --temp-cutoff 87 `
        --temp-overheat 80 `
        --temp-target 70 `
        --api-port 4028 `
    --no-submit-stale `
    --auto-fan `
    --api-listen `
    --api-network `
    --no-pool-disable `
    --scrypt `
--config "$miner_path"
} GOLD_Digger




Monday, January 27, 2014

svchost is utilizing 100% of the CPU

The other night I ran into an issue I haven't seen for a little while, having seen this in the past and knowing what I did to resolved the issue, I decided I'd make a little write up to help anyone else that might run into this problem.This my friends, is what you call a memory leak.

What is a Memory leak exactly?
Microsoft describes it as: "RPCSS makes synchronous calls to track object identifiers (OIDs) for clients as part of the Distributed Component Object Model (DCOM) pinging mechanism. During this process, RPCSS acquires a handle and memory, which are not released if these clients are not pumping window messages efficiently. This causes a handle and memory resource leak in the Svchost.exe process."


Do Not Ever end a svchost service without first knowing which services are attached. Svchost.exe is short for "service host", this is not a virus; In fact it's a required system component. You'll usually find multiple copies of svchost.exe running. Svchost.exe is a program that is designed to run other programs and "hosts" many of the system services in all Microsoft Operating Systems up to Windows 8.1(latest released O\S). 

First things first
Since there are multiple copies of svchost running on every Windows O\S you must first find out the PID of the specific svchost.exe that is using all of the computers CPU or memory. To do this hold down [CTRL]+[SHIFT] and [ESC] at the same time to open the 'Task Manager' and click on the 'Details' tab if using Window 8 or newer or 'Processes' if using an older O/S.


To show the 'PID' within the task manager you must first right click on any tab and then left click on 'Select Columns'. This will open the 'Select Properties Page Columns' where you must check the checkbox next to 'PID (Process Identifier)'.


Notice the PID (Process Identifier) of the svchost.exe process that is consuming all of the resources. In this case PID 484 is utilizing the most resources.


To see all the running copies of svchost.exe
From within an Administrative CMD prompt type "tasklist.exe /SVC | more". The /SVC switch will display the services hosted within each process.

Notice the services within PID 484:(one of these services are the culprit)
AeLookupSvc, AppInfo, BITS, Browser, CertPropSvc, IKEEXT, iphlpsvc, LanManServer, ProfSvc, Schedule, SENS, SessionEnv, ShellHWDetection, Themes, Winmgmt, or Wuauserv. Right now there are 16 services running under PID 484, now we must separate these 16 services into their own PID. This will show us the service that is causing all this trouble.

Note: Winmgmt and wuauserv are pretty common culprits. I would start with these services.





Now that we've narrowed the list of possible culprits we can start separating the services into their own PID's by running the following command in an Administrative CMD prompt:

 sc config servicename type= own

for instance:
sc config Winmgmt type= own



This will break the Power Service out of PID 484 group into it's own PID. Just continue to do this until you find the service that is going crazy and restart that service if applicable.

Note: Most commonly this is due to a bug of some sort with the Windows Update Service or wuapp for short.