Questions tagged [powershell]

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, and takes over from previous languages such as VB Script.

837 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14
votes
1answer
906 views

Using defaultAuthenticationType with PowerShell Web Access

PowerShell web access lets you choose the authentication type. By default, it uses a value of Default, which ends up being Negotiate. I have set up CredSSP to allow logging into the PSWA server itself ...
9
votes
3answers
8k 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 | ...
9
votes
2answers
6k views

Changing physical path on IIS through appcmd isn't activated

We have come across an issue on IIS 7.5 where we have a simple deploy system which consists of the following: Create a zip-file of new webroot, consisting of three folders: Api Site Manager This is ...
7
votes
2answers
4k views

Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps'

I've tried reinstalling SQL Server 2014 and I'm still getting the following error message when trying to import-module sqlps. The same registry key exists, but is appended with 120. I'm able to use ...
6
votes
1answer
2k views

Can't use UPN credentials with New-MoveRequest?

We're on a hybrid setup (Exchange 2013 on-prem), and MRSproxy is enabled and working. We want to archive our user's mailbox when they leave the company. So we want to migrate those mailbox from the ...
6
votes
2answers
4k views

Setting a VM boot CD via PowerCLI

I have a sneaking suspicion that this may be a bug, but I'm definitely willing to entertain the possibility that I'm doing things wrong. I have a VMware virtual machine in $vm, and I'm trying to ...
6
votes
1answer
391 views

Adding features to Windows Server gets slower the more features you add

I'm troubleshooting an issue we're seeing with all of our Windows Server 2016 servers. The more features we add to the operating system, the slower the features are to add. For example, execute Add-...
6
votes
2answers
6k 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 ...
5
votes
0answers
82 views

File locked only for Developer that tries to deploy

Our Developers work with VisualStudio 2017 They use a Post-Build PowerShell function that I wrote, to publish the application to the correct destination. Sometimes (1 out of 100 times) they get the ...
5
votes
1answer
4k views

Enter-PSSession on localhost is failing

I am attempting to execute the following Powershell command: Enter-PSSession -ComputerName localhost The server in use is running Windows Server 2008 R2 SP1 64-bit. The server is on a domain. I am ...
5
votes
3answers
1k views

Compressing folders with long paths

I am now the proud owner of my company's off-boarding script (Yay!). I have been going through the code and testing, and I noticed that on some users' homefolders I am hitting PowerShell's 260 ...
5
votes
2answers
3k views

cUrl for an HTTPS address/domain times out unless previously accessed from browser

I've lost a couple days to this problem and hope it sparks a thought from someone. I am integrating several systems together using Powershell scripts. One of the two services I am connecting to (...
4
votes
0answers
81 views

What would be causing “PowerShell.exe” to hang upon opening on multiple systems and/or how can I troubleshoot it?

What would be causing "PowerShell.exe" to hang upon opening on multiple systems? I've waited for over 60 minutes, but it never fully starts. All it does is show the blue shell window with the ...
4
votes
0answers
299 views

How do I use Get-MessageTrackingLog w/o expanding the distribution groups?

When executing: Get-MessageTrackingLog -sender <sender> -Start <date> | Select TimeStamp,EventID,Source,Sender, @{Name='Recipients';Expression={ [string]::join(";",($_.Recipients))...
4
votes
0answers
3k views

Adding windows capabilities to Windows server core running in docker

I am running the microsoft/windowsservercore:1803 in docker: docker run -it microsoft/windowsservercore:1803 inside it, I start powershell and run the Get-WindowsCapability cmdlet and get the ...
4
votes
1answer
909 views

How do I run Register-ScheduledJob from a script running as SYSTEM?

I'm trying to run Register-ScheduledJob from a script executing as SYSTEM (from an external deployment tool), but I get an error. This must be initially invoked as SYSTEM due to the way the deployment ...
4
votes
1answer
1k views

Remove ACL from Windows Registry Key via Powershell

I am trying to create a startup script that can be distributed via GPO to laptops (running 64bit Windows 7 Professional) to make it impossible for any user (including local administrators) to display ...
4
votes
1answer
379 views

Windows Server firewall track connection state

I am trying to control a Windows Server 2012 (R2) firewall by using PowerShell commands (see https://technet.microsoft.com/en-us/library/hh831755.aspx#BKMK_ProfileGlobalDefaults for example and ...
4
votes
1answer
989 views

Powershell DSC File copy - Workgroup machines

I've got a machine that I need to copy files to from a network share (on domain) for a deployment from a machine that's off domain. Currently I have the following code; Configuration deployWebsite {...
4
votes
1answer
564 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 ...
4
votes
1answer
8k views

Identifying mailboxes with corruption Exchange 2013

We're preparing to rid ourselves of Exchange on-premise and are migrating from an outsourced hosting provider to go to Office 365. We're running a fully patched version of Exchange 2013, atop Server ...
4
votes
1answer
232 views

Besides looking dumping $PSVersionTable and dumping the variable and env “PS-Drives”, what else can I do to compare PowerShell environments?

Besides looking dumping $PSVersionTable and dumping the variable and env "PS-Drives", what can I do to compare PowerShell environments? Here's the problem: I have very similar machines running ...
4
votes
1answer
107 views

Look on all server desktops for outstanding files before deleting profiles

We have about 70 servers that we are in the process of moving into a domain environment, so we are converting our users from local accounts to domain controlled accounts. How can we determine which ...
4
votes
1answer
496 views

How to do proper error handling in a push setup?

I am currently building a lab environment to get a feeling on what DSC can accomplish and where the limits are. We have a requirement to push out one-shot configurations to group of nodes based on ...
4
votes
0answers
342 views

Set CMTrace Font

Might be a bit of a long shot but I was wondering if anyone knew of, or could speculate on, a way to change the default font of CMTrace. It seems to use some Sans-Serif font. I'd like to change it to ...
4
votes
1answer
258 views

My PowerShell $profile path has no $HOME prepended

I have PowerShell installed on two different Server 2008 R2 systems. On one system, $HOME is prepended to $profile, but on the other nothing is prepended: Server 1 (PowerShell 2) PS C:\> echo $...
4
votes
4answers
4k views

Importing NTFSSecurity module from UNC path fails

I've created a central repository for Powershell modules, but I'm having trouble loading one in particular. The NTFSSecurity module is failing to import with the following message. PS Z:\> Import-...
3
votes
0answers
114 views

Windows 2016 Server - Start Menu Layout - Get-StartApps - Different APPID's

In our Windows Server 2016 Terminal Server Farm I tried to make a default start layout. After some research, it finally works how I want it to. However, I have a question about the different kind of ...
3
votes
0answers
216 views

Powershell Remoting not working

I have PSRemoting working on 90% of my servers. But there are a handful that I'm not sure what's going on with them. Server 2016. Most of them are Hyper-V hosts, but not all. Enable-PSRemoting -...
3
votes
1answer
876 views

How to assign a Windows service least privileges to provision new accounts

We have a Windows service which currently runs as LOCAL_SYSTEM - effectively a local administrator. One of the functions of the service is to provision new local accounts and add them to a specific ...
3
votes
0answers
1k views

Is there a way to create a PEM file using PowerShell and only PowerShell?

I'm looking for a way to create an AES-128 key in PEM format (Base64 encoded text file) using PowerShell. All the examples I can find assume the user has OpenSSL installed. The equivalent OpenSSL ...
3
votes
0answers
2k views

PowerShell high CPU usage in Windows Server 2012 R2

I'm facing this problem recently: My server gets very slow, I went to check and see one instance of PowerShell using a lot of the CPU. I force the task to end and after some hours it comes back. The ...
3
votes
1answer
525 views

How to tell (in Powershell) whether Install-ADDSForest is complete?

I have a powershell script that runs Install-ADDSForest to set up a lab environment. The script is actually run via VMware tools. During the Install-ADDSForest process, the Windows server (2012) will ...
3
votes
1answer
537 views

robocopy wierd behavior for /copyall

When I use robocopy with /copyall flag, the 1st attempt for the files will be display as "New Files" and the output will display the number of new files copied and other transfer/bytes information. ...
3
votes
1answer
106 views

Programmatically/remotely remove untrusted but “bound” Windows from Active Directory

Due to some mistakes, I have a lot of machines that seem to be bound to Active Directory (AD) from their side, but not from the side of the AD. The machines thinks they are still in the AD, but the AD ...
3
votes
0answers
153 views

Regulate Implicit Remoting Sessions

Summary: After running netstat, I noticed that my local device has several established connections to the remote server using port 5985 as seen below: PS > netstat Active Connections Proto ...
3
votes
2answers
239 views

Set-AzureRmAutomationModule is unable to find Automation Account

I am trying to upload a custom DSC module to our Azure Automation account. C:\Code\Epitec DSC [master ≡ +1 ~1 -1 !]> Set-AzureRmAutomationModule -Name "WindowsUpdate" -ContentLinkUri "{ContentURL}....
3
votes
1answer
2k views

Getting Connection error while running AWS commands in powershell in windows 2012

We have installed AWS powershell tools with the given below version. When we try to run the AWS commands we get connection error as specified below: ---- AWS Powershell version--- PS C:\Users> ...
3
votes
0answers
3k views

Palo Alto Globalprotect - connect via cmd

Scenario: Windows box having the Palo Alto Globalprotect vpn client installed. Is it possible to use commandline or powershell to connect the vpn client to a remote host? I know this is possible ...
3
votes
2answers
17k views

WinRM cannot connect

I am trying to get two workgroup machines (both are Windows 2012 R2) to talk to each other using PowerShell via WinRM. Let's call them ServerA and ServerB. On both machines I ran the following ...
3
votes
0answers
606 views

Why does Get-Winevent in parallel workflow wants to use PSRemoting?

I'm building a wrapper script for Get-Winevent to search multiple computers' event logs in parallel, using multiple search criteria. I'm contructing a XML filter for Get-Winevent, then call this ...
3
votes
1answer
821 views

IIS - overrideModeDefault enforced in PowerShell, not IIS UI

I am trying to modify an IIS Web Application that is installed, and change the Authentication Methods. The Default Web Site is set to alloy Anonymous, and disable everything else. When I use the ...
3
votes
1answer
2k views

Add Startup and shutdown scripts to Local Group Policy using Powershell

I am trying to automate adding startup and shutdown scripts to Local Group Policy (gpedit.msc). One solution is to write to registry directly as pointed out in http://ccm.net/faq/3358-execute-a-script-...
3
votes
1answer
178 views

Trying to use powershell to selectively erase old backup files

I am working with a drive with thousands of backup files, many of which are just cluttering space. The program our employees use creates a backup of a spreadsheet every time they open one for editing....
3
votes
1answer
681 views

Exchange Online Powershell Dynamic Dist. List of Contacts

We have Exchange online with Office 365. I am trying to set up a dynamic distribution list of external mail contacts if their address contains a certain email domain. I have tried the powershell ...
3
votes
1answer
934 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 ...
3
votes
1answer
2k views

Adding multiple users from a group to an Active Directory group using Powershell

I have a powershell script that is supposed to go through a specific ou and store the groups into a variable $groups. Here is the code I use in the script: $Groups = Get-ADGroup -Properties * -...
3
votes
1answer
2k views

Powershell IIS plugin - cmdlets not working

I'm pretty much a novice at Powershell so bear with my noobness. I'm specifically trying to run the "Get-WebBinding" cmdlet (which I have successfully run on some of my other servers) Windows Server ...
3
votes
1answer
1k views

NRPE (Winrpe) Powershell Command - Unable to read output in Nagios

I'm trying to run an Powershell script from NRPE.cfg and get the output in Nagios. When i run the script on the local (Windows) server, everything is just fine. But when i put it in the NRPE.cfg en ...
3
votes
1answer
848 views

Move-Item command only partially succeeding

I'm running a simple script to archive SMDR logs using Windows Server 2008 R2's Task Scheduler. The last line of the script is as follows -- dir c:\smdr -Filter *.txt | where-object {$_.basename -eq ...

1
2 3 4 5
17