Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Browsing all 8583 articles
Browse latest View live

Q: What is the best way of passing parameters to my Windows PowerShell script?

A: Windows PowerShell has an easy way to pass parameters. The following first line accepts a parameter with a default value.Read More

View Article


Populating a table with data from a CSV

I'm trying to import data into a table I have created in SQL2008 Express, I've used the same scripts for other tables and they have worked, I get the following error:Invoke-Sqlcmd : Invalid object name...

View Article


Running 'Start-Process' Remotely: How to Display Standard Output?

I have a PowerShell script for installing software on remote computers.To date I have been successfully using the following code:$prog = "ping" $arg = "localhost" $computername = "MACHINE01"...

View Article

Error Catching and Exceptions

All,Why doesn't my catch block catch this error?"Get-ChildItem : Cannot find path '\\docvfs01\pre_dev$\' because it does not exist."I have tried catch as } catch {......} and } catch [EXCEPTION]...

View Article

Free Download: CMD to PowerShell Guide for AD

Hi folks. It's your friendly, neighborhood PFE again. In order to avoid the long lines to buy a treadmill the first week of January I thought I would save you some time and give you an easier New Years...

View Article


Q: How can I convert a PowerShell script into a module that works like a...

A: Typically, Windows PowerShell scripts are saved as ps1 files. However, if a file is saved as a psm1 file, it can be treated as a module.You need to ensure your script has functions defined in it...

View Article

PowerShell Web Access: Installation Guide

Since v2, Windows PowerShell has offered a great remote management story. With PowerShell v3 and the arrival of Windows Server 2012 it gets even better: How would you like to be able to remotely manage...

View Article

PowerShell Web Access: Configuration

We're back with our look at Powershell Web Access (PSWA), a multi-part series in which I walk you through the installation, configuration, testing, and reconfiguring PSWA for use in the domain....

View Article


Import Text File and execute command

Hi,ill try to import a File with a list of computers and the do a psexec remote command.$dev=Import-CSV C:\temp\servers.csv foreach ($element in $dev){ & C:\temp\PStools\psexec.exe "\\"$dev...

View Article


Checking how may times a substring appears in a string.

Hello All,I am a big fan of RegEx (always trying to learn something new), and though I would post this tip (by the way how do you post tips on the poweshell tips section?)If you have a string like this...

View Article

Query AD over a persistent session - "Not enough storage is available to...

 # Name : ListComputers.ps1# Purpose: Get all active / inactive computers from Active Directory#param (    [string]$server = "$(Read-Host 'Server')")# Get user credentials$cred = Get-Credential# get...

View Article

Q: How can I have a certain PowerShell module always load when I start...

A: You have a choice of several approaches. One is to create a custom Windows PowerShell launch command that includes the import-module command or calls a script that has a number of import-module...

View Article

PowerShell Studio 2012: Full-featured tool provides extra help

Takeaway: Derek Schauland reviews what is included in PowerShell Studio 2012, a third-party tool to help you learn and use PowerShell commands.Read More

View Article


Getting Started with PowerShell and Active Directory

PowerShell is a powerful tool. It’s also very different than the cmd and VBScript way of doing things that we’ve suffered through since the beginning of time. About a year ago, I set out to rewrite our...

View Article

Bootable USB Drive Using Powershell

How to make a USB flash drive bootable and to copy an operating system ISO using Powershell v3 on Windows 8.Read More

View Article


Aligning columns in Out-GridView

Hi Folks,I've created a PowerShell script to display logical disk information on a local or remote computer.Is it possible to right align a column in a grid?I use PowerShell version...

View Article

SharePoint 2010 and PowerShell 3.0

SharePoint 2010 does not support PowerShell 3.0 at this time. If you or your admin team install PS 3.0 on your SharePoint 2010 farm, you will have some compatibility issues with the SharePoint 2010...

View Article


Pseudo-Polymorphism in PowerShell

When learning a strongly-typed, object oriented language one of the first concepts you learn is polymorphism. Polymorphic members accept object types that define a particular contract. Class instances...

View Article

Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005...

Hi Richard,I am a newbie to Powershell.  I have been reading and testing code while learning.  Right now, I am stuck on something I am sure is silly.My code:#$strUser = Read-Host "Enter user...

View Article

Check for specific files

HiIs there a way I could use the following code and use the Get-Content cmdlet to loop through file names contained in the text file and return "files does not exist" with the else statement if the...

View Article
Browsing all 8583 articles
Browse latest View live