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)

1
vote
1answer
26 views

Test impact of DSC script using vNext in Release Management

Following the examples on the web, it's not hard to set up a working example for the first DSC script. However, I need to find a way to just list the changes that the script will make, not actually ...
1
vote
1answer
29 views

What's the “supported” way of using Exchange PowerShell cmdlets in a script?

From what I've read, Microsoft doesn't support using the Exchange PowerShell cmdlets from anywhere but the Exchange Management Shell. However, surely people need the ability to script things and run ...
0
votes
1answer
2k views

Exchange 2010 Search-Mailbox to delete Exchange Journal emails

I am using this PowerShell command to try and delete emails from our Exchange Journal, [PS] C:\Windows\system32>Search-Mailbox -Identity exchangejournal -SearchQuery ...
9
votes
1answer
137 views

Windows Remote Management Over Untrusted Domains

I am currently trying to enable Windows Remote Management (specifically, Powershell Remoting) between 2 untrusted domains, and having no luck. A brief description of my setup: domain1 - my ...
0
votes
0answers
19 views

How to refer to office365 user using Set-Mailbox in Powershell

I'm trying to change a user mailbox to a room mailbox in powershell. I know the basic command is: Set-Mailbox "John" -Type Room When I try to run this, I keep getting an error that says the object ...
7
votes
3answers
416 views

Cannot set Powershell ExecutionPolicy for CurrentUser

Here is a sample of the commands I am running: PS C:\> Get-ExecutionPolicy -List Scope ExecutionPolicy ----- --------------- MachinePolicy Undefined UserPolicy ...
1
vote
1answer
18 views

Test if PowerShell script being called with Invoke-Expression?

Is there a way to tell if a script is being called using Invoke-Expression rather than called directly? I want to do something different, e.g. pause for input, if the script is being called directly ...
2
votes
1answer
7k views

How to select a user and remove all groups they are a member of using Powershell (with Quest)?

I've read quite a bit online about this and thought I had found a solution, but it doesn't seem to be working like I would expect. I am wanting to get a user based on the username I input, then ...
0
votes
0answers
49 views

How do I troubleshoot “Failed to get staged packages for package” error when attempting to remove a provisioned app from an offline Windows 8.1 image?

When I attempt to remove provisioned apps from an offline Windows 8.1 image, most of the apps I want to remove cause no problem, but attempting to remove Microsoft.Office.OneNote causes an error. The ...
1
vote
1answer
1k views

Exception Enumerating SQL Server Instances with SMO WMI ManagedComputer

I'm trying to use the SMO WMI API/objects in PowerShell 2.0 on Windows 7 with SQL Server 2008 R2 installed to get a list of SQL Server instances on the local computer using the Managed Comuter object. ...
2
votes
2answers
2k views

powershell v2 remoting - How do you enable unecrypted traffic

I'm writing a powershell v2 script that I'd like to run against a remote server. When I run it, I get the error : Connecting to remote server failed with the following error message : The ...
1
vote
1answer
23 views

Powershell to non-domain machine

I'm writing a small script that needs at one point to connect to a machine that is not a domain member. The machine the script is run from will always be a domain member. I've found that using the ...
2
votes
1answer
55 views

Set-NetFirewallRule alternative in Windows Server 2008

I am trying to Enable Powershell Remoting on a Windows Server 2008, but from what I understand, the default firewall exception is that PSRemoting is only allowed if the computer (both client and ...
0
votes
2answers
61 views

powershell change filename using first 10 characters and mask

This script was working fine for a while but I have found that users don't always comply with the correct naming conventions for it to be effective. I have been banging my head trying to modify it but ...
3
votes
2answers
2k views

What version of Windows Management Framework is installed?

How do you check to see what version of Windows Management Framework (WMF) is installed? It seems like it should be a simple thing to find out, but I cannot. Even Googling a bunch of different ...
0
votes
0answers
31 views

ERROR: OpenSSL::PKey::RSAError: data is too large for key size", when trying to upload cookbook 'learn_chef_iis'

I am receiving the following error message: "ERROR: OpenSSL::PKey::RSAError: data is too large for key size", when trying to upload cookbook 'learn_chef_iis'. I was following a CHEF tutorial and now I ...
0
votes
2answers
1k views

Set group permission on folder

I have a folder with lots of subfolders D:\Data\Subfolder1 D:\Data\Subfolder2 D:\Data\Subfolder3 D:\Data\Subfolder4 D:\Data\Subfolder5 ... I need to create three active directory groups ...
2
votes
1answer
62 views

How to combine two foreach loops?

I've looked at how to combine multiple commands with psexec but none of the methods seems to work. Maybe it's because I'm running the script in PowerShell and not cmd.exe? I need to create user ...
0
votes
3answers
1k views

Enable-PSRemoting on Windows Server 2008 R2 error

When giving the command Enable-PSSRemoting with or without the -Force parameter this error occurs Set-WSManQuickConfig : More data is available. At line:50 char:33 + Set-WSManQuickConfig ...
2
votes
2answers
54 views

How can I retrieve a domain computer's details from AWS Directory Service?

I know using the AD module for powershell that we can retrieve domain computers details and export them as csv. My domain is in AWS Directory Service, and I have a computer under this domain. I tried ...
0
votes
1answer
970 views

DPM 2012 running powershell script in task scheduler

I'm having a problem running a custom PS script I created to attach systems into the console. My PS script works when i'm running it interactively in the DPM Management Shell. I was referencing this ...
0
votes
1answer
36 views

What permission is needed to use a service account to remote run powershell on a server?

I have a internal webapplication With a list of all the servers in our network. I want to be able to run a few PowerShell commands on the servers to gather usefull information. Invoke-WMIMethod and ...
1
vote
2answers
110 views

Retrieve internet proxy server address via PowerShell

I have to retrieve the proxy server address and port via PowerShell, so I can use the Invoke-Webrequest -uri http://some-site.com -Proxy command. The expected output should looks like ...
1
vote
1answer
75 views

Scheduled task deployed via GP, that runs a powershell script on a network share by a AD service account

I've created a powershell script that runs Chocolatey updates as well as does some logging locally and on a network share. The script itself resides on a network share, and I'm hoping to be able to ...
4
votes
2answers
1k views

Why am I getting unauthorized errors with Powershell get-winevent?

I'm a domain admin equivalent, I've tried running in an elevated console (right-click> run as administrator), and I'm consistently getting errors when executing get-winevent -logname application | ...
6
votes
1answer
103 views

Powershell's equivalent to Bash's process substitution

Bash has <(..) for process substitution. What is Powershell's equivalent? I know there is $(...), but it returns a string, while <(..) returns a file the outer command can read from, which is ...
1
vote
1answer
59 views

Retrieve SCCM collection membership via PowerShell

I'd like to find a PowerShell script that retrieve the SCCM collections for a given computer or user. I know this can be achieve via a SCCM query, but I'd like to do this using a PowerShell function. ...
0
votes
0answers
51 views

Invoke-RestMethod cmdlet not found in Orchestrator 2012 R2 Run .Net Script Activity

I'm trying to use Invoke-RestMethod in a PowerShell script within an Orchestrator 2012 R2 runbook. When I run the runbook, it tells me: The term 'Invoke-RestMethod' is not recognized as the name ...
1
vote
1answer
54 views

WMF 5.0 (April Preview) DSC Pull Server Installation fails

I am trying to install The DSC-Service Windows Feature on a Windows 2012 R2 machine with WMF 5.0 already installed. The installation fails with the following errors: Install-WindowsFeature ...
0
votes
0answers
25 views

PowerShell script to click a javascript hyperlink [migrated]

Powershell script to open webpage and click a specific link I am trying to write a script that opens up a specific webpage and clicks a specific link. I cannot edit the HTML as it is embedded on a ...
1
vote
0answers
46 views

PowerShell - How to format the output of two distinct commands in one table? [migrated]

Foreach($a In Get-GPO -All) { Foreach($b In $a | Get-GPPermissions -TargetName "Domain Admins" -TargetType Group) { $a.DisplayName; $b.Trustee.Name; $b.Permission } } I use the command to output all ...
1
vote
1answer
45 views

Win Terminal Server/RDS - dynamic printer mapping after session reconnect

I am trying to figure out this Problem: When a user disconnects his/her RDS (on Windows Server 2012 R2) session in Office 1 and reconnects in Office 2, then still all the Printers relevant to Office 1 ...
1
vote
2answers
58 views

Polling FTPS/SFTP Server with Windows Server 2012

Is it possible to securely routinely poll an external FTPS (or SFTP) server and copy/move the files locally using standard Windows Server 2012 functionality? I imagine the use of scheduler to do the ...
1
vote
1answer
36 views

Moving one website from one server to another using powershell

I've been reading about MS Deploy and writing a small script to export/import one website from one server to another server(IIS8 to IIS8). But I ran into sizing problems and some other errors and the ...
9
votes
4answers
12k views

PowerShell remove force

Trying to delete a directory recursively with rm -Force -Recurse somedirectory, I get several "The directory is not empty" errors. If I retry the same command, it succeeds. Example: PS I:\Documents ...
11
votes
1answer
6k views

How do I run my PowerShell scripts in parallel without using Jobs?

If I have a script that I need to run against multiple computers, or with multiple different arguments, how can I execute it in parallel, without having to incur the overhead of spawning a new PSJob ...
0
votes
1answer
197 views

“Maximum number of items that can be serialized or deserialized in an object graph” when executing GetMsolUser -All

I have an office 365 tenant on which I execute the following command Get-MsolUser -All on server A I get get-msoluser : The formatter threw an exception while trying to deserialize the message: ...
8
votes
3answers
218 views

PowerShell: Get-ADUser Properties with åäö

I'm trying to extract select sets of users with Get-ADUser. The users belong to companies whose names include non-ASCII characters, e.g. "Gåäördet". Unfortunately, we do have to use the company ...
3
votes
2answers
2k views

How can a set a Security Group's email address using PowerShell?

I need to create many groups with email addresses. I would prefer to use Security Groups to reduce the number of groups we have to maintain, otherwise we'd have an identical Distribution Group for ...
11
votes
4answers
2k views

Windows Powershell Vim Keybindings

Is there a way to get vim keybindings in powershell as you would in bash or zsh with a command like set -o vi
2
votes
1answer
51 views

remote Powershell script Scheduled task

I am having trouble running a Powershell script as a scheduled task. The script remotely logs into two Hyper-V hosts, queries the replication status and emails the result back to me. The script works ...
1
vote
1answer
76 views

How to execute a powershell script from a remote application as a specific user

I have an application which can execute a powershell script on remote windows machine. I am trying to map a network drive using a powershell script. When the same script executed at the endpoint, ...
0
votes
1answer
13 views

Unable to perform enable-bitlocker and lock-bitlocker successively

I am trying to enable bitlocker on windows server 2012 R2 data volume using following command: Enable-BitLocker -MountPoint $volume -Password ($password | ConvertTo-SecureString -AsPlainText -Force) ...
0
votes
1answer
37 views

PowerShell Write-Host not synchronous

I'm writing a PowerShell script to check some properties of a server. When I execute the following cmdlets in order, the output is not displayed in the order I expect. Write-Host "=== Operating ...
4
votes
3answers
6k views

Powershell: lastLogonTimestamp blank for some users

I am developing a script to report on users who have not logged in to the domain for 6 months. I'm using lastLogonTimestamp as within 14 days is precise enough for my purposes, and I don't want to ...
2
votes
1answer
137 views

powershell pipeline object to function

Here's the stub of what I'm trying to do: function Set-test { [CmdletBinding()] param( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [object[]]$inputObject ...
1
vote
2answers
51 views

Exchange 2010 PowerShell: Value.ToMB() Method Fails Remotely but Works Locally

I am building a report of certain mailbox attributes from Exchange Server 2010 using PowerShell. The following code worked perfectly from my management workstation using a remote session. $Mailboxes ...
0
votes
1answer
96 views

Is there any outlook.exe /resetfolders equivalent that can be executed against all Exchange mailboxes?

Outlook can "Restore missing folders for the default delivery location" if ran with a switch "outlook.exe /resetfolders". This is good for just one or two mailboxes. What can I do if I need to do this ...
2
votes
1answer
68 views

Install Active Directory PowerShell module on Windows Server 2012

I need to install the AD PowerShell module on Windows Server 2012 but I can't afford for the server to restart during business hours. My question is can the AD module be installed from Add/Remove ...
3
votes
0answers
57 views

Get-Process not working against remote Windows 7 clients

I have been trying to run Microsoft's GetNetworkStatistics script against remote computers to enable us to track what processes are using bandwidth along with other tools. I am unable to run the ...