Skip to main content

Posts

Showing posts from January, 2013

Installing Windows Server 2012 Hyper-V

Windows Server 2012 Hyper-V server is essentially Windows Server 2012 Server Core that is designed in only run Hyper-V.  You do not have to worry about purchasing a license for Hyper-V server.  The Host OS is free.  You do need to properly license any virtual machines (VMs) that you run on the Hyper-V server however. Setup is a breeze. It was, for the most part, just like installing Server Core.  It is also very fast.  Just download the installation software from Microsoft . For this deployment, I plugged a keyboard, mouse , and monitor into my target server so I can observe all the action.  Really, there is not much to watch once you get things started. Once the server starts up, you need to give it a password for the local administrator account. Then SCONFIG opens up.  Use SCONFIG with the following options to place this server in your domain and make it manageable. 8) Give this server a static IP address. 1) Add to the domain.  You can also...

How to speed up the time out process in PowerShell

While executing scripts against a large number of clients in your organization, you will undoubtedly encounter a few that are offline.  This causes your script to hang on each one.  This pesky little behavior can be mitigated in a variety of ways.  The function below is what I use when I need to run a script synchronously.  You simple give it the name of the client you are attempting to contact and the number of retries it gets.  I usually only give it 1.  It will return TRUE if contact was made.  You then make a decision of what to do at that point. I allow the script to proceed if the response is TRUE or I send the client name to an error log if it is FALSE. Function Test-ClientConnectivity { Param (     $ComputerName ,     $Loop = 4 )     # Set the control value to zero.     $Count = 0     Do {         $Count ++ ...

When did a client last start?

This is a question that I often have to ask a user.  The problem is that our users answers cannot always be considered…shall we say “reliable.”  Below is a PowerShell function that you can use to to determine when the client in question was last started.  Here is what you get when you run this function. PS C:\windows\system32> Get-LastStartTime -ComputerName Work-PC Last Startup Time: 12/31/2012 1:44:43 PM I’m using this as part of the HelpDesk module that I creating for my up coming book and also I’ll be demonstrating the full module at the Cincinnati PowerShell users group meet up on Thursday, February 21, 2013.  Here is a link to the event .  Our focus will be on using PowerShell with your Help Desk. # ............................................................................. # Function Get-LastStartTime # Retrieves the last start time on the client machine. Function Get-LastStartTime { Param ( $ComputerName = "." ,     [ Sw...

Use PowerShell to Rebalance Your Portfolio

Years ago I was introduced to portfolio rebalancing by a friend that I used to work with.  In short, portfolio rebalancing allows you to sell off some stock in funds that have increased in value, and then buy more shares in funds that have decreased in value.  This allows you to sell high, buy low.  The company that currently manages my business retirement plan does not have an option for this, but I am allowed to transfer funds between different investments without fees. Below is an example of two concepts that I use in my PowerShell classes.  One is how to gather information from the internet and the other is how to use the XML variable type in PowerShell.  You will have to create a CSV file that contains three pieces of information.  FUND, QUNATITY, ALLOCATION.  The Fund will be the ticker symbol for a stock or mutual fund.  The quantity will be how much of that fund you own.  The allocation is a percentage of how much of your portfolio ...