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 ArticlePopulating 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 ArticleRunning '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 ArticleError 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 ArticleFree 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 ArticleQ: 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 ArticlePowerShell 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 ArticlePowerShell 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 ArticleImport 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 ArticleChecking 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 ArticleQuery 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 ArticleQ: 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 ArticlePowerShell 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 ArticleGetting 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 ArticleBootable 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 ArticleAligning 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 ArticleSharePoint 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 ArticlePseudo-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 ArticleGet-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 ArticleCheck 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