PowerShell is Microsoft's new scripting language in 2006, significantly upgraded in 2009 (v2), 2012 (v3) and 2014 (v4). It allows interpreted scripts based on PowerShell cmdlets and .NET primitives.

learn more… | top users | synonyms (1)

3
votes
1answer
843 views

How to Load commands into your powershell profile to run on starting powershell

I have found a way to load exchange 2010 powershell into powershell running on a windows xp workstation, however there are a few commands that need to run. I was wondering how I could load them into a ...
3
votes
2answers
1k views

Printer monitoring script (PowerShell)

I am going to write a script of some sort to check event viewer in a windows server 2003 for all printjobs, and then write them to a comma delimited textfile like printername_floor_room.txt I am ...
4
votes
2answers
8k views

Why does my PowerShell script hang when called in PSEXEC via a batch (.cmd) file?

I'm trying to remotely execute a PowerShell script using PSEXEC. The PowerShell script is called via a .cmd batch file. The reason we do this is to change the execution policy, run the powershell ...
0
votes
1answer
128 views

Powershell: Conditionally changing objects in the pipeline

I'm converting a CSV to SQL inserts and there's a null-able text column which I need to quote in case it is not NULL. I would write something like the following for the conversion: Import-Csv ...
4
votes
2answers
5k views

Start ELEVATED script from within script

Hallo, I'm playing around with Powershell (relative NewBie) and I'm looking for the easiest way to call a Powershell script with elevated rights from within another script. I know of the runas verb ...
1
vote
2answers
1k views

Get-QADComputer -LdapFilter & NOT operator

I'm having issues excluding an OU from my LDAP filter $DaysAgo = (Get-Date).AddDays(-31) $ft = $DaysAgo.ToFileTime() Get-QADComputer -SizeLimit 0 -IncludeAllProperties -SearchRoot ...
3
votes
2answers
6k views

Dismount USB External Drive using powershell

I am attempting to dismount an external USB drive using powershell and I cannot successfuly do this. The following script is what I use: #get the Win32Volume object representing the volume I wish to ...
3
votes
2answers
1k views

How to detect when Antivirus is out-of-date with Powershell

Is it possible to use powershell to determine if/when the antivirus was last updated on a Win7 or Win2008 Server machine?
13
votes
6answers
27k views

How to get robocopy running in powershell?

I'm trying to use robocopy inside powershell to mirror some directories on my home machines. Here's my script: param ($configFile) $config = Import-Csv $configFile $what = "/COPYALL /B /SEC/ /MIR" ...
1
vote
1answer
2k views

How to troubleshoot a remote wmi query/access failure?

I'm using Powershell to query a remote computer in a domain for a wmi object, eg: "gwmi -computer test -class win32_bios". I get this error message: Value does not fall within the expected range ...
1
vote
1answer
2k views

Get-QADComputer -LdapFilter & variables

Can I use a variable in and LdapFilter with Get-QADComputer? i.e.: $31DaysAgo = (Get-Date).AddDays(-31) $ft = $31DaysAgo.ToFileTime() $StComps = Get-QADComputer -SizeLimit 0 -IncludeAllProperties ...
5
votes
2answers
1k views

Powershell import-module webadministration

Every time I execute this command invoke-command -computername REMOTEPC -scriptblock { import-module WebAdministration; new-item "$env:systemdrive\inetpub\testsite" -type directory; New-WebSite -Name ...
3
votes
3answers
809 views

Increase number of concurrent shells in PowerShell V2

I'd like to increase number of concurrent shells in PowerShell V2.I tried using the following command ,but I got no luck.The error I got is" Error: Invalid use of command line. Type "winrm -?" for ...
2
votes
3answers
1k views

Powershell Remoting: Howto Run a Comand on multiple Machines with individual Parameters?

For example: Lets say i have 10 servers (Server 1-Server10) and a csv list where i have the servernames and a individual Foldername/Path for each server. How would i create these Folders on each ...
1
vote
2answers
2k views

Powershell Set-Acl fails

While working on a little backup script I try to change the ACL of a file using Set-Acl in Powershell 1 on Vista and always get the following error message: Set-Acl : The security identifier is not ...
0
votes
2answers
2k views

Querying Domain Controller objects using Powershell

Could someone explain to me why this does not work? Import-Module ActiveDirectory $dcs = Get-ADComputer -Filter {DistinguishedName -Like "*Domain Controllers*"} I get no results for this query. ...
14
votes
4answers
22k views

How to set ExecutionPolicy: access to registry key denied

I'm running Windows Server 2008 as admin and I tried to set ExecutionPolicy as Remotesigned for PowerShell v2 like this: Set-ExecutionPolicy RemoteSigned But I got this error: Set-ExecutionPolicy ...
1
vote
1answer
253 views

Powershell Remoting: Execute local function on two target servers

I have a function foo on my local Machine. (In my profile, but calling c:\scripts\foo.ps1 would be also OK!) How do i load this on ServerA and ServerB so i can execute the function in the next ...
1
vote
2answers
305 views

My PowerShell functions do not appear to be registered

I have a ps1 script in which I define 2 functions as such: function Invoke-Sql([string]$query) { Invoke-Sqlcmd -ServerInstance $Server -Database $DB -User $User -Password $Password -Query $query } ...
1
vote
1answer
3k views

How do I reset all BITS jobs from PowerShell?

In Windows 7, the BITSAdmin command has been deprecated in favor of BITS PowerShell cmdlets. What is the PowerShell equivalent of the command bitsadmin /reset /allusers?
1
vote
2answers
2k views

Create new vms with a template with a csv. Possible?

I am new to Powershell and Powercli... but i manager few ESX environments and really would like to do as much as possible via powershell. I am trying to do as much as i can via Powershell. On with the ...
0
votes
2answers
582 views

How do I add an IP address to a users dial in tab within powershell

How do I add an IP address to a users dial in tab within powershell. I want to do it about a 100 times so I was hoping to use the ad cmdlets to perform the task reading from a csv file the account ...
2
votes
2answers
434 views

Export-Mailbox - fails with large folders

I am trying to move messages from a rather large mailbox to an archive mailbox. However I run into errors all the time. the command I am executing is Export-Mailbox -Identity MAILBOX_FROM ...
0
votes
1answer
229 views

I would like to send the wifi wep key automaticaly to laptops on the lan via powershell

How do I send the wifi wep key automaticaly to laptops on the lan via powershell
7
votes
3answers
18k views

Adding a user to the local Administrator group using powershell

I would like to use powershell to add a spesific user to the local administrator group on a machine. I would be running the powershell script in the context of a user that has Administration rights ...
1
vote
3answers
4k views

How to connect Home Folder using PowerShell

I tried to create user using New-QADUser cmdlet. I know this cmdlet has -HomeDrive switch. But the problem is that cmdlet is just applying path string to user's account and not creating user's home ...
3
votes
2answers
658 views

Howto use PowerShell to parse IIS logs files

I am looking for samples on howto parse IIS log files. I am just getting started, and rather then search for site, I want personal recommendations how sample sites, sample code or a good book to get ...
1
vote
2answers
4k views

How to set or clear “Manager can update membership list” using PowerShell

For distribution group, I can set parameter Manager can update membership list using the ADUC mmc, but I can't find how to do it using PowerShell. Moreover, even is Manager can update membership list ...
2
votes
2answers
1k views

Powershell script to pull users from an ad group and create folder with permissions

I saw a question that was similar however the answer they got was in vbscript. (http://serverfault.com/questions/33861/powershell-command-prompt-create-folders-from-ad-group-members) I need to create ...
1
vote
1answer
991 views

Free/busy information from powershell?

Are there any powershell commandlets for reading free/busy information in exchange 2007/2010? I have been unable to find any.
1
vote
2answers
2k views

Using Export-Mailbox without including subfolders

I want to delete a certain group of messages from somebody's mailbox. I already have the basic Powershell command ready to go: Get-Mailbox -Identity jshmoe | Export-Mailbox -SubjectKeywords ...
1
vote
2answers
2k views

PowerShell: Copy all AD users of an OU to another OU

I'm trying to copy all users of OU "A" to the OU "B". My PowerShell shot at this is $sourceEntry = [ADSI]"LDAP://OU=A,DC=demo,DC=com" $targetEntry = [ADSI]"LDAP://OU=B,DC=demo,DC=com" $searcher = ...
1
vote
3answers
3k views

How do I increase maximum attachment size in Exchange 2007 SP1?

I've been looking all over for a relatively simple answer to a fairly straightforward question: "how do I increase the maximum size of attachments that can be sent and/or received in Exchange 2007?". ...
2
votes
3answers
997 views

HBA card status

Is it possible somehow to get status of a HBA card using PowerShell or any other API instead of logging to a server and run "powermt display path"?
32
votes
8answers
49k views

SSH via PowerShell

Is it possible to open an SSH session in PowerShell? Currently I use PuTTY but it would be nice if that were not required.
3
votes
1answer
2k views

Is PowerShell 2.0 on Windows XP SP3 64 bit possible?

The normal location for the download of PowerShell v2.0 is Windows Management Framework (Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0) (KB 968929). You'll notice that there isn't a listing for ...
1
vote
1answer
687 views

There a easy way to move/change a public folder structure exchange server 2007?

I looking to see if anyone has had any experience with restructuring a public folder tree that basically requires the movement of a public folder from one subfolder to another. I figure that we would ...
5
votes
11answers
60k views

Windows command prompt: how to get the count of all files in current directory?

What command would you use in cmd.exe to find the number of files in the current directory? Is there a powershell option here? Update: I was hoping to avoid dir, as I know there are 10,000+ files in ...
3
votes
2answers
12k views

How to uninstall software using batch file

I want to uninstall a software by calling a bat file. It must be automatically, without entering any parameters during the uninstallation. How to make the bat file which would be able to uninstall ...
2
votes
1answer
437 views
1
vote
4answers
898 views

Compare-Object gives false differences

I have some problem with Compare-Object. My task is to get difference between two directory snapshots made at different times. First snapshot is taken like this: ls -recurse d:\dir | export-clixml ...
0
votes
1answer
3k views

Windows 08 R2 Backup : create task template

it is possible to create a backup template or somehow configure backup shedule besides regular daily backup to local disk. I want to backup whole system every sunday to shared network folder. I must ...
4
votes
1answer
613 views

get-eventlog issue

I wanted to get a quick report of some log entries I saw on a server, so I ran: Get-Eventlog -logname system -newest 10 -computer fs1 | fl I got events back however the descriptions were all wrong. ...
3
votes
2answers
2k views

How to get DNS SERVER Statistics ? Total Queries per day ? (windows Server 2003)

Using a script (powershell for example) How can i get the total Queries on a DNS Server (Windows Server 2003 - Active Directory Environment) ? Thanks
1
vote
5answers
2k views

Replce Kix script with Powershell

We are looking to replace our current Kix scripts with Powershell scripts and I was curious how to test group membership to map network drives. Our current kix script basically just does an if ...
0
votes
3answers
855 views

Console apps don't work in Powershell

I've inherited a Windows Server 2003 r2 box. I've got a Powershell script that I'd need to get running on the machine, but something seems terribly wrong with the system. For example, opening a ...
3
votes
2answers
996 views

IIS Administration PowerShell Cmdlets on Windows 2008 R1

I am trying to use IIS Administration PowerShell Cmdlets on top of Windows 2008 R1. According to this article you need to load these Cmdlets. However the options to load the cmdlets does not exist in ...
1
vote
1answer
1k views

PowerCLI Syntax: copy-harddisk

Whats the correct syntax for coping a vmdk with PowerCLI? I'd like to do the same as vmkfstools -i Get-HardDisk Machine1 | Copy-HardDisk "[DS] Machine2/test.vmdk" Produces: Copy-HardDisk : ...
1
vote
1answer
622 views

Powershell 2.0 : issue import-Module in a background job

I launch a script in backgroung using Start-Job command. In this script, I load a module using Import-Module. The job stay blocked in the running state at the Import-Module step. The same behaviour ...
2
votes
1answer
4k views

Use Powershell to find out what uses lots of memory (on 64 bit Windows)

How do I find out (in Powershell) what process/whatever uses the most memory? Edit: I am trying to figure out how to use Powershell to find out what's using all the physical memory in case Task ...