An interactive shell, scripting and programming language, and surrounding environment from Microsoft. Commonly used by system administrators managing Microsoft software (including Windows, Exchange, SharePoint, and cloud services Azure and Office 365), PowerShell is included by default with Windows, ...

learn more… | top users | synonyms (1)

0
votes
2answers
2k views

SNMP custom commands on Windows

For a while I've monitored UNIX/Linux servers using SNMP. Modifying the snmpd.conf file and adding something like view systemview included .1.2.3.4.5.6.789 pass .1.2.3.4.5.6.789 /bin/bash ...
0
votes
1answer
739 views

Windows Powershell requires me to press Enter after the command finishes [duplicate]

Possible Duplicate: Sometimes PowerShell stops sending output until I press enter. Why? I am executing powershell commands like: powershell.exe "Get-Process java | Stop-Process" and when ...
4
votes
3answers
590 views

Test if user logged in PC in the network

How can I check if a specific user is logged in on a specific computer on my active directory network? I am administrator in this network and would prefer to do it with powershell but I am open to ...
1
vote
1answer
700 views

I need to use powershell to add a txt file as mail body(not attachement),is there anyway to do that?

$mail.Subject = "testforloop"; $mail.Priority = "normal" $mail.Body = #I need contents form a txt file here (e.g. D:\results)# Any good ideas to deal with it? Thanks!
2
votes
2answers
263 views

Is there a better way of writing this powershell script?

Below is my Powershell script to delete certain backup files on my servers and then display their contents. There is a lot of repetition. Is there a more efficient way of performing this task? ...
5
votes
2answers
3k views

Installing an SSL Certificate in Windows Server 2008 using powershell

Is it possible to Install an SSL Certificate in Windows Server 2008 R2 using powershell? If it's not, is it possible with cmd command line? I am doing it with mmc now but would it be nice to do that ...
0
votes
2answers
714 views

Doest Get-PSDrive can map network space?

Here are my codes, $var.droppath is a valid network space path, I've test it. $map3 = new-PSDrive -name droppath -psprovider FileSystem -root $var.droppath Then I ran Get-PSDrive | ?{$_.Name ...
1
vote
1answer
340 views

Failed to check share space via recorded path form sql database by powershell

Could anybody tell me why I failed on these code? 1, I connect to database 2, I query useful information from database (get path) 3, I checked the free space under queried path Here are my codes: ...
0
votes
1answer
4k views

How do I run a search query based on recipient in PowerShell for Exchange 2010?

I've tried to run the following commands but neither work and I'm not sure how I should setup the query. I tried to find a full list of available search strings but couldn't locate one online or using ...
0
votes
1answer
381 views

query different free share spaces by powershell, but every time got the same result

Here is my codes: $map = new-Object -com wscript.Network $map.mapNetworkDrive("v:","\\sharespace\testbuilds\test1") $fso = new-Object -com Scripting.FileSystemObject $do = $fso.getdrive("v") ...
0
votes
1answer
6k views

query from sql table via powershell

I've created a SQL Server database with a simple table on my local machine. I try to query some information from this table. Here is my code: $connection= New-Object ...
0
votes
1answer
3k views

Connect to local SQL Server database via PowerShell failed with error: Named Pipes Provider, error:40

Please tell me why I failed with this connection...how should I do then? local machine name = MYPC local instance name = MSSQLSERVER my own database named mydatabase I use Windows authentication to ...
1
vote
2answers
2k views

PowerShell script failure on remote execution

On executing a PowerShell Remote Script I am getting an error like following Invoke-Command : Exception calling "ToXmlString" with "1" argument(s): "The requested operation cannot be completed. ...
2
votes
1answer
5k views

Access Denied when Adding or Modifying AD Groups in Powershell

I needed to create a large number of Domain Local security groups in AD, so wanted to script it with PoSH rather than manually create each one. I am getting an Access Denied error if I try to create ...
3
votes
4answers
3k views

get-adcomputer error: “Invalid Enumeration Context” when running powershell script

We're switching to WDS for deployment, so I'm writing a powershell script that will ping a computer and if it responds, get its MAC address and set the netbootGUID field in Active directory. It runs ...
4
votes
2answers
2k views

Piping powershell messages to Write-EventLog

I have a powershell script that runs a custom cmdlet. It is run by Task Scheduler and I want to log what it does. This is my current crude version: Add-PsSnapIn MyCmdlets Write-EventLog -LogName ...
2
votes
3answers
1k views

Exchange deferred delivery: update message “Date:” header

A client is using the "deferred delivery" feature in Outlook / Exchange. For some reason this feature does preserve the original message creation time (i.e. when the user has hit the "send" button) as ...
2
votes
1answer
2k views

Need help making an ODBC MySQL Connection

Short Version: How do I connect from PowerShell to an ODBC 5.1 MySQL Driver? I can't seem to find any connection strings that accurately have a "Provider" field for this particular instance. (See ...
3
votes
2answers
1k views

Is it possible to add a Windows service dependency using powershell?

I know there is this sc.exe where you can add and set Windows service dependencies, but I was wondering if the same thing can be done using Powershell.
3
votes
3answers
250 views

Powershell Version

Everytime I try to run a Enter-PSSession -ComputerName name, I am logged on to version 1.0 even tought 2.0 is installed. Being the powershell newbie, I looked into the registry in ...
1
vote
1answer
1k views

PowerShell - Set IIS 7.5 FTP Site to 'Allow SSL connections'

Using PowerShell, how can I script the setting of an IIS 7.5 site to 'Allow SSL connections' rather than 'Require SSL connections'? I cannot seem to identify the name of the configuration property I ...
1
vote
1answer
478 views

Scripted check for a specific feature from an msi installer

I need to be able to check for the installation of a particular feature from an msi installer. For context, I need to check whether the "Powershell Cmdlets" feature (TFPS from Feature table in Orca) ...
2
votes
4answers
267 views

possible efficient ways of transferring files from one server to another

what are the possible good and efficient ways of transferring files from one server to another? In this case it will be from windows server 2003 to windows server 2008 r2. I am thinking Powershell ...
1
vote
1answer
786 views

Using Powershell, how do I eject an ISO image from a Hyper-V virtual machine?

I'm using the Hyper-V module for PowerShell, and I've successfully mounted an ISO file onto a virtual machine. Question is: how do I eject (or unmount) it? I'd prefer to use the PSHyperV stuff, if ...
1
vote
1answer
2k views

List _all_ AD user properties with powershell

We have a former Win2k AD domain, which is migrated to W2k3 servers, and has a slew of schema extensions (Exchange, msSFU, and self-defined) from the past and various parts of the forest. Searching ...
1
vote
1answer
141 views

How can I manipulate Code Access Policy using Powershell?

I had a task today to add a new Code Group to my PC, using mscorcfg.msc. Having recently learned how to use Powershell, I thought, how can I do the same thing using Powershell (everything looks like ...
5
votes
3answers
12k views

Cannot get CredSSP authentication to work in PowerShell

In attempting to create a PowerShell script using remoting I ran into what I believe is the double-hop problem. In that article, Perriman gives a succinct description of the problem as well as the ...
0
votes
2answers
290 views

Missing PowerShell Commands in SharePoint Foundation 2010

I installed SharePoint Foundation 2010 on Windows Server 2008 R2. I notice that no SP cmdlets are available in the PowerShell. What did I miss?
5
votes
1answer
275 views

Why is $pshome in a “v1.0” directory?

I'm clearly running powershell v2.0.x on Windows 7. PS C:\> $PSVersionTable Name Value ---- ----- CLRVersion 2.0.50727.5444 ...
15
votes
4answers
19k views

Check if user password input is valid in Powershell script

I am working with a Powershell script that adds scheduled tasks to systems in our domain. When I run this script, it will prompt me for my password. I sometimes fat finger the password and the process ...
1
vote
1answer
47 views

net file for admin drivenet file

Simple question for you this morning. I'm currently using the net file command in command prompt to obtain the connected user to a drive (F). I want to know how can I do to get the same information, ...
1
vote
1answer
5k views

Exchange 2010 SP1 - View size of “Deleted Items” per user

I'm looking for a quick way to obtain a per-user accounting of the size of the "Deleted Items" folder on an Exchange 2010 SP1 system. This is a recent migration, and I'm just trying to get an ...
3
votes
2answers
1k views

Reinitialize a single Exchange 2010 mailbox?

I'm running PST import tests on a new Exchange 2010 SP1 server. I'm interested in seeing if there's a quick way to restore the account to default and clear its contents. Kind of a reset or ...
0
votes
1answer
120 views

PowerShell - type no inside every directory and open up notepad2

Do you know the notepad command in PowerShell or cmd.exe? I would like to do the same for NotePad2 I would like to type the following command inside PowerShell and open up the me.txt file; PS ...
5
votes
1answer
2k views

Powershell script to find if a user has logged in since last reboot

So I've been working on a Powershell script that needs to detect if an interactive logon has happened since the last reboot. I can force the system to restart before I launch the task, but I'd like to ...
4
votes
4answers
7k views

Copy multiple folders to a single destination with robocopy

I'm looking for a solution to use robocopy to copy several folders from a directory onto a distant network share. I want to choose several folders out of a directory that contains hundreds of folders ...
1
vote
2answers
272 views

Copy Directory Structure with Date File Filter to UNC Share in PowerShell

How can I copy all files that match a filter and the directory structure to UNC path will powershell: For example with the filter as "*2011_01_02*.bak": \arf.2011_01_02.bak ...
2
votes
1answer
624 views

Converting WMI from vbscript to powershell

I'm trying to follow the guides for accessing IIS 6 using WMI but I'm having trouble working out how to translate the Get method of SWbemServices as Get-WmiObject doesn't seem to use the same path ...
3
votes
2answers
587 views

Encrypt powershell Credentials (creds) files

I have started to play around with PowerCLI and therefore created a credentials file to use when I connect to vCenter. The purpose for this will be to run scheduled tasks, such as running the vCheck ...
1
vote
2answers
897 views

Powershell - winrm using ip address instead of computer name

Is it possible to set up winrm using IP address instead of the computer name. The computer in question is only I have only been able to set winrm up for a computer in the same domain like this: ...
5
votes
1answer
2k views

Sudo !! equivalent in PowerShell

"Sudo !!" invokes previously executed command with administrator privileges in *nix shell. Is there an equivalent in PowerShell?
3
votes
2answers
602 views

Connecting to Exchange PowerShell from a Linux machine

We currently have a Python script that automates user creation tasks on our servers. This script provisions users in OpenLDAP and ActiveDirectory by using python-ldap. Now, I want to modify some ...
15
votes
5answers
80k views

Need to add a “Wait” command to a Powershell script

Here is my current code: Write-output “ENTER THE FOLLOWING DETAILS - When Creating Multiple New Accounts Go to EMC hit F5(refresh) and make sure previous new account is listed before ...
2
votes
1answer
690 views

How do I uninstall an ActiveX control via Powershell

I have to constantly switch back and forth between two installations of a web app with two different versions of an ActiveX control. Therefore I'd like to script the ability to uninstall this control. ...
1
vote
2answers
1k views

Windows 2008 R2 Scheduled Task Not Running With Admin Privileges even if granted?

I have a scheduled task that is running as USER. I have checked the box "Run with highest privileges" in the scheduled task properties. The task is a powershell script that, among other things, ...
2
votes
2answers
418 views

script to run windows update on hyper-V images

I have over 10 hyper-v images that I use for testing various projects. Some I use often some less so. It is a lot of work starting each of the machines individually to run windows update. I was ...
0
votes
2answers
6k views

When ran as a scheduled task, cannot save an Excel workbook when using Excel.Application COM object in PowerShell

I'm having an issue where I've automated creating an Excel.Application COM object, add some data into a workbook, and then saving the document as an xlsx. This works fine if: I'm already in ...
6
votes
5answers
7k views

How to run a PowerShell script from Cygwin SSH session?

Hi I have Windows Server 2003 with CopSSH installed on it ( Cygwin + sshd ). W would like to be able to run a PowerShell script via SSH session command and then use it's output. Is there such ...
1
vote
2answers
1k views

How can I update HTTP custom headers in IIS6 using Powershell?

I have the following Powershell script which uses WMI to update the HTTP custom headers on a website in IIS 6. The script seems to work fine, no errors generated, and the resultant $website object ...
2
votes
1answer
275 views

Active Directory Administrative Center Powershell

Natively Active Directory Administrative Center (ADAC) doesn't give you the powershell alternative when performing any function, like Exchange Management Console. Is there a way to change this or is ...