Browse by Tags

Tagged Content List
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Answer 3

    Summary : Here is the answer to the third question in Mini-Scripting Games 2014. You are writing a script, and when it runs, you receive an error message that states: “You cannot call a method on a null-valued expression." What is the first thing you should check? Check the code that...
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Answer 2

    Summary : Here is the answer to the second question in Mini-Scripting Games 2014. On your laptop running Windows 8.1, you are running Hyper-V. You have heard that there are cmdlets that let you manage this. You open Windows PowerShell and type the following command: Get-VM Absolutely nothing...
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Answer 1

    Summary : Here is the answer to the first question in Mini-Scripting Games 2014. On your laptop running Windows 8.1, you opened the Windows PowerShell console and typed Get-Disk . You were greeted with an error message that says: “Get-Disk: Access to a CIM resource was not available to the client...
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Question 4

    Summary : Here is the fourth short-answer question for Mini-Scripting Games 2014. You are attempting to use Try/Catch/Finally in your script. No matter what you try, the script never seems to catch it. What is the most likely cause of the problem? Answer to be posted next week!
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Question 5

    Summary : Here is the fifth short-answer question for Mini-Scripting Games 2014. You created a constant variable in your Windows PowerShell console. Now when you attempt to delete the variable, you get an error message. How can you remove a constant variable? Answer to be posted next week!
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Question 3

    Summary : Here is the third short-answer question for Mini-Scripting Games 2014. You are writing a script, and when it runs, you receive an error message that states: “You cannot call a method on a null-valued expression." What is the first thing you should check? Answer to be posted...
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Question 2

    Summary : Here is the second short-answer question for Mini-Scripting Games 2014. On your laptop running Windows 8.1, you are running Hyper-V. You have heard that there are cmdlets that let you manage this. You open Windows PowerShell and type the following command: Get-VM Absolutely nothing...
  • Blog Post: PowerTip: Mini-Scripting Games 2014 Question 1

    Summary : Here is the Mini-Scripting Games 2014 first short-answer question. On your laptop running Windows 8.1, you opened the Windows PowerShell console and typed Get-Disk . You were greeted with an error message that says: “Get-Disk: Access to a CIM resource was not available to the client...
  • Blog Post: PowerTip: Find PowerShell Canonical Aliases

    Summary : Find Windows PowerShell aliases that are read-only and available in all scopes. How can I produce a list of Windows PowerShell aliases that are read-only and are available in all Windows PowerShell scopes? Use the Get-Alias cmdlet to produce a list of aliases, filter on aliases that have...
  • Blog Post: PowerTip: Use PowerShell to Identify Users Without a Photo

    Summary : List all users who do not have a photo assigned in Active Directory. Is there a simple way that I can use Windows PowerShell to identify users who do not have a photo assigned in Active Directory? Target the ThumbnailPhoto property, and filter the users for Null : GET-ADUSER –filter...
  • Blog Post: PowerTip: Find How Many Days Are in a Month

    Summary : Figure out how many days are in a month by using Windows PowerShell. How can I use Windows PowerShell to find how many days are in a particular month? Use the DaysInMonth static method from the System.DateTime object. It expects the year and then the month as arguments. Here are a couple...
  • Blog Post: PowerTip: Find Syntax for PowerShell Method

    Summary : Use Windows PowerShell to find the syntax for a method. I am trying to figure out how to use a .NET Framework method, but it is not working. How can I get a better idea of what to do? Call the method with no parenthesis or parameters, for example: [DateTime]::DaysInMonth
  • Blog Post: PowerTip: Determine if PowerShell is a 64-Bit Version

    Summary : Use Windows PowerShell to easily find out if the shell is a 64-bit version. How can I use Windows PowerShell to determine if I am currently running a 64-bit version? Use the Is64BitProcess static method from the System.Environment class: [System.Environment]::Is64BitProcess
  • Blog Post: PowerTip: Expand Environmental Variables with PowerShell

    Summary : Learn to expand the value of environmental variables by using Windows PowerShell. How can I use Windows PowerShell to find the value of a common environmental variable such as %username% or %computername% ? Use the ExpandEnvornmentalVariables static method from the System.Environment...
  • Blog Post: PowerTip: Use PowerShell to Find Printer Configuration

    Summary : Use Windows PowerShell in Windows 8.1 to easily find the configuration of printers. How can I use Windows PowerShell to see the configuration of all printers defined on my Windows 8.1 system? Use the Get-Printer cmdlet and pipe the results to the Get-PrintConfiguration cmdlet: get...
  • Blog Post: PowerTip: Use PowerShell to List Time Zones Defined on System

    Summary : Use Windows PowerShell to list time zones that are defined on a system. How can I use Windows PowerShell to produce a list of all the time zones that are defined on my system? Use the System.TimeZone .NET Framework class, and call the GetTimeZones static method: [System.TimeZoneInfo...
  • Blog Post: PowerTip: Use PowerShell to Display Square Root of Number

    Summary : Use Windows PowerShell to display the square root of a number. How can I figure out the square root of a number when I am writing a Windows PowerShell script? Use the Sqrt static method from the System.Math class. This example obtains the square root of the number 9: [math]::Sqrt(9...
  • Blog Post: PowerTip: Wire Up PowerShell GUI Buttons

    Summary : Learn to use the OK and Cancel buttons in a Windows PowerShell GUI. How can I use Windows PowerShell to get my GUI’s OK and Cancel buttons to trigger when the user presses ENTER or Escape? Assign the OK and Cancel button objects to your form’s AcceptButton and CancelButton...
  • Blog Post: PowerTip: Use PowerShell to Create Temporary File Name

    Summary : Use Windows PowerShell to create a temporary file name. I need to output data to a file, but I do not need a permanent file name and location because the file will be later deleted. How can I easily use Windows PowerShell to create a temporary file name? Use the GetTempFileName static...
  • Blog Post: PowerTip: Use PowerShell to Display Invalid File Names

    Summary : Use Windows PowerShell to display invalid file name characters. How can I use Windows PowerShell to display information about invalid file name characters? Use the System.IO.Path class and call the GetInvalidFileNameChars static method: [System.IO.Path]::GetInvalidFileNameChars()
  • Blog Post: PowerTip: Check Status of PowerShell Preference Variables

    Summary : Learn to easily check the value assignments of Windows PowerShell preference variables. How can I use Windows PowerShell to quickly check the value of Windows PowerShell preference variables? You can use the Windows PowerShell variable drive and look for variables that end with the word...
  • Blog Post: PowerTip: Use PowerShell to Create Two Column Output

    Summary : Create a two column output of data by using Windows PowerShell. How can I use Windows PowerShell to create output that has two columns? Use the Format-Wide cmdlet, and then use the –Column parameter to specify a number of columns, for example: Get-Process | Format-Wide name ...
  • Blog Post: PowerTip: Start PowerShell with No Profile

    Summary : Start Windows PowerShell with no profile to troubleshoot scripts. How can I use Windows PowerShell to troubleshoot a script that sometimes works and sometimes does not? Look for any external dependencies by starting Windows PowerShell with no profile. Use Start/Run, and in the dialog...
  • Blog Post: PowerTip: List All Parameters for a Cmdlet

    Summary : Learn to provide a parameter list for a cmdlet in a viewable table. I am trying to work with cmdlets with so many parameters that I am having a hard time reading them in Get-Help . Is there a way to list them in a single table? Access the Parameters property by using Get-Command and the...
  • Blog Post: PowerTip: Identify All Properties for Active Directory User

    Summary : Use the –Properties parameter to find all properties attached to an Active Directory user. How can I use Windows PowerShell rather than digging through the ADSI editor to find the available properties for a user in our Active Directory? Leverage the –Properties parameter on...