PowerShell is Microsoft's new scripting language in 2006, and significantly upgraded in 2009. It allows interpreted scripts based on PowerShell cmdlets and .NET primitives.

learn more… | top users | synonyms (1)

1
vote
2answers
43 views

Powershell - Set-ClusteredScheduledTask - Error “Incorrect function.”

I'm experimenting with Powershell to add a ClusteredScheduledTask on a clustered server (Win 2012/R2) Technet sample code gives error: #canned exampled from ...
2
votes
3answers
920 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 ...
1
vote
1answer
18 views

Errors when attempting to update source files, Server 2012R2 (errors 80073701 and 14081)

I have a Windows Server 2012R2 machine that I installed with Server Core, and then decided that I wanted to switch to GUI. I'll make the long story short: I ran windows updates, and now the source ...
0
votes
1answer
15 views

Using New-ADComputer's -ServicePrincipalNames

I'm trying to use the New-ADComputer -ServicePrincipalNames parameter with no success. $comp = New-ADComputer -passthru -name "server1" -path "ou=Org2,ou=Org1,dc=mydomain,dc=com" -DNSHostName ...
4
votes
1answer
2k views

Why do weekly tasks created via PowerShell using a different user fail with error 0x41306

We have some scripts that create scheduled jobs using PowerShell as part of our application. When testing them recently, I noticed that some of them always failed immediately, and no output is ever ...
1
vote
1answer
1k 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 ...
0
votes
1answer
26 views

How to execute a Powershell cmdlet as a specific user and save the return value in a variable?

How can I execute a Powershell cmdlet as a specific user and save the return value in a variable? What I got so far is this snippet Start-Process powershell.exe -Credential $credentials -NoNewWindow ...
1
vote
2answers
54 views

AD Group and Distribution Group with O365

I have a O365 with Exchange, and a local AD. I want to manage distribution groups and distribution groups members via PS scripts (that will run by scheduled task), that look users' AD attributes ...
0
votes
1answer
14 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 ...
0
votes
0answers
26 views

How to Create a mailbox in Exchange 2010 with Linux

How do I create from a linux server (with winexe installed) a new mailbox for a user that's already known in Active Directory? When I try the following: ./winexe -U ...
1
vote
2answers
33 views

New-ManagedContentSettings - not working properly under Exchange 2010

I have a client that is divesting a business unit into a new AD forest, Exchange org, etc. We're using Quest tools to migrate users and mailboxes. However, I have to build the new infrastructure to ...
3
votes
2answers
209 views

Automatically reconfigure WinRM HTTPS listener with new certificate?

I am looking to enable WinRM HTTPS listeners on all of our servers for secure communication when using CredSSP between servers to get around the double-hop issue. Setting this up is fine, we have ...
1
vote
1answer
126 views

Looking for a powershell script that can pull a file from a set of PC's and FTP

I'm looking to write a script (preferably powershell) that will essentially copy a file from a bunch of PC's and FTP it to a server. So the structure of the environment is that we have a file on ...
0
votes
2answers
39 views

Exception calling “UploadFile” with “2” argument(s): “The Content-Type header cannot be set to a multipart type for this request.” [duplicate]

I am working with a script that is supposed to first check if a PC is alive then FTP a file to a server. However, when running the script I am getting the following error: Exception calling ...
0
votes
1answer
12 views

How do I create a mailbox in powershell and determine which mailstore it creates it in?

I need to edit a powershell script that creates new users and add a section that creates them a mailbox, problem I am having is that I need it to check the first letter of the username to determine ...
-1
votes
0answers
29 views

How to access Virtual machine using powershell script

I want to access the virtual machine using powershell script. For that I used below script, Enter-PSSession -computername sheetal-VDD -credential compose04.com\abc.xyz1 where, sheetal-VDD is ...
-1
votes
1answer
38 views

Best Practices for User folder permissions [closed]

The following is my bat file. Is there a way I can substitute First.Last with usernames from a CSV file? My boss doesn't want to do all the users at once. He's afraid that something may happen so he's ...
2
votes
3answers
1k views

Export Windows Server configuration to powershell script?

I'm looking for a way to export role/feature configuration to a scriptfile, like powershell. Lets say you've installed the DHCP-Role. You configure the scopes, reservations and all that stuff you ...
-1
votes
0answers
21 views

PowerShell - Retrieving files on a remote server via the click of a button on a .aspx web page [migrated]

Here's my problem: I have a PowerShell script which runs successfully when I execute the script from PowerShell itself. However, when the script is called via the click of a button on a web page, it ...
1
vote
2answers
24 views

Scripting for Public Calendars in Office 365

We have about 10 onsite technicians who do breakfix work. I would like to create a unified calendar that shows all of their appointments for the day, week and month without having to populate it ...
9
votes
3answers
1k 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
0
votes
1answer
18 views

Extract Summary property from VMM with PowerShell

I have a Windows Server 2008R2 running SCVMM 2012. I successfully removed a virtual machine, according to the Jobs output from VMM, as seen in this screenshot. As you can see, the VM has a red ...
1
vote
1answer
34 views

Get-MaskingSet in PowerShell 2.0

I'm trying to retrieve the current masking sets using PowerShell 2.0 on a Windows Server 2008 R2. Unfortunately, the cmdlet Get-MaskingSet does not exist under this PowerShell version. Are there any ...
5
votes
2answers
1k views

Issues with patching servers remotely using winrm and Microsoft.Update.Session

I have a network with windows 2003, 2008 and 2008r2 servers. I have a powershell script that I wrote to patch a local machine using the "Microsoft.Update" com objects. (Similar to Windows Update ...
0
votes
2answers
143 views

KQL Query to specify date range for Mailbox search?

I'm trying to verify some phone numbers using our exchange server with the following query to send the results to my inbox: Get-Mailbox | Search-Mailbox -SearchQuery “Body: '*XXX-XXX-XXXX*' OR ...
0
votes
0answers
34 views

I am unable to set the owner of a folder back to the user from my bat file

The following bat file is being used to fix permissions for Users in our organization. Everything works perfectly until we try to set the owner back to the user. takeown /F F:\Users\First.Last /R ...
4
votes
2answers
283 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 | ...
0
votes
1answer
1k views

How do I make ncat not send a line-feed?

I'm on Windows 7 Powershell and have ncat from http://nmap.org/ncat/ I'm trying to send "foo" to some network device PS> ncat -u 192.168.1.255 6061 foo but it sends "foo\n" (66 6f 6f 0a) and ...
6
votes
2answers
91 views

Invoke-Restmethod breaks script in PS 4.0

I had a Powershell script that used Invoke-RestMethod that was working in powershell 3.0. However, I upgraded to powershell 4.0 to fix a bug in powershell 3. When I did so, my script seems to have ...
2
votes
2answers
50 views

Format disk with diskpart if not formatted

I'm trying to write a script to create and format a partition in Windows Server 2008R2. Now, when disk 1 is selected, I need to format it, only if it is not formatted already. This is what I have ...
0
votes
0answers
28 views

Active Directory Lightweight Directory Services user-credentials

Does anyone know how the "user-credentials" string is encoded/encrypted that is used for Active Directory Lightweight Directory Services? Thanks. ...
1
vote
1answer
404 views

Modify IIS web.config using PowerShell

I'm trying to modify the web.config using PowerShell. So far, I'm able to replace the Connection String using: Set-WebConfigurationProperty -pspath "IIS:\Sites\$Name\WS" -filter ...
0
votes
3answers
43 views

How do I display a string property?

In the scenario below, how do I use a .NET method to display the pscomputername property, returned by Get-DnsServerForwarder? Get-DnsServerForwarder -ComputerName db3testads001 | gm EnableReordering ...
0
votes
1answer
24 views

PowerShell 'get-ClusterQuorum' output is not showing 'QuorumType' column

PowerShell cmdlet get-ClusterQuorum output is not showing QuorumType column. Has anybody seen this before?
0
votes
2answers
3k views

How can I reset settings for Internet Explorer using a script?

I'm looking to reset Internet Explorer back to factory defaults using a batch file. I'd also like to delete: all Downloads, History, Cookies and Cache, plus anything else in a user's IE profile.
-2
votes
0answers
30 views

Powershell Copy Function very slow

We have a main files server for a local office, I placed a ESXI host in one of our data centres, I used the recursive copy function to create a small powershell script, and scheduled this for 9pm. For ...
1
vote
2answers
46 views

Modify CIFS share ACL's

I would like to modify permissions on a number of NetApp CIFS shares (over 100). These are user shares and each share has a different user with "Change" share permission, this permission now needs to ...
0
votes
3answers
648 views

Move-ADObject errors upon taking CSV-file input

Hoping you can help! Where I work, when we create a user, the object is put in "CN=>User's full name<,OU=Something1,OU=Something2,DC=SomethingElse,DC=local". From there the user object needs to ...
0
votes
1answer
811 views

How to save event logs “Network Policy and Access Services” on NPS server

We have a Windows Server 2008 R2 Enterprise server with NPS role installed in it. (We dont use NAP). Is there any way, we can save all the event logs in------ Event Viewer -> Custom Views -> ...
1
vote
1answer
910 views

How to start SMTP [SMTP Virtual Server #1] through powershell or command prompt

Because of some error on my server my SMTP [SMTP Virtual Server #1] stop. I wanted to create job which will run periodic timely and check the SMTP server status, If its stop then it will start it ...
-1
votes
3answers
352 views

How to change default install path for Notepad++ in Powershell silent/unattended script

I cant figure out the parameter(s) to change the default install path C:\Program Files\ of Notepad++ to the drive I want it to install to when I run my PowerShell script. I am trying to do a silent ...
1
vote
1answer
36 views

How to start a runbook using web service call to SC Orchestrator in Powershell?

I have System Center Orchestrator 2012 R2 and I want to start a Runbook on the runbook server by calling the web service. The orchestrator console works fine if I browse to it like so: ...
-2
votes
1answer
56 views

powershell script that outputs date of the day as a file name

I have a script which lists local admins of all hosts in Active Directory below: $Searcher = New-Object DirectoryServices.DirectorySearcher([ADSI]"") $Searcher.Filter = "(objectClass=computer)" ...
3
votes
1answer
149 views

How to catch Exceptions with PowerShell

I am getting this error. Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) At F:\Code\powershell\network_shutdown\TurnNetworkOff.ps1:19 char:26 + ...
22
votes
2answers
921 views

Is there a way to loop through Windows 8 Apps and remove them all?

Windows apps are annoying and I would like to remove them. Been playing around with Powershell and scripting and I wanted to know if there was a way I could make Powershell to loop through all the ...
0
votes
1answer
90 views

PowerShell startup script applied via GPO failing ambiguously

Script: $folder = "$env:HOMEDRIVE\TestFolder" New-Item -ItemType directory -Path $folder note that the same group policy error occurs when $folder is set to "C:\..." Execution policy is ...
3
votes
1answer
63 views

I am getting Invalid class errors for my PowerShell script

When I run this script, I get this error Get-WmiObject : Invalid class “Msvm_ImageManagementService” and Get-WmiObject : Invalid class "MSPower_DeviceEnable" and Get-WmiObject : Invalid class ...
2
votes
1answer
842 views

SQL Server: How to report error from a job's step of PowerShell type

I have a SQL job whose step of 'PowerShell' type does 'exit 1' if encounters an error i.e. $ErrorActionPreference='stop'; trap{"$_"; exit 1} Problem is, SQL Server doesn't pay attention to that exit ...
0
votes
1answer
41 views

Automate app pool recycling of an Azure Cloud Service Web Role

How can I script (e.g. using PowerShell) the action to recycle the app pool of a web site hosted in a Web Role on Azure Cloud Services? Only one instance of the cloud service is running (used for ...
2
votes
1answer
4k 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 ...