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.

1,020 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
16 votes
1 answer
2k 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 ...
briantist's user avatar
  • 2,555
10 votes
2 answers
7k 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 ...
jishi's user avatar
  • 878
7 votes
2 answers
8k 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 ...
Russ960's user avatar
  • 243
6 votes
1 answer
5k views

LongPathsEnabled Setting ignored on Windows Server 2016

I need to be able to create a path structure that is longer than 260 characters on a Windows Server 2016 system. After thoroughly reading through various sources, I understand that Windows Server 2016,...
vic's user avatar
  • 973
6 votes
1 answer
11k 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 ...
Clark's user avatar
  • 61
6 votes
0 answers
2k 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 -...
UnknownGnome's user avatar
6 votes
1 answer
4k 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 ...
shinjijai's user avatar
  • 416
6 votes
1 answer
10k 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 ...
Daniel Schealler's user avatar
6 votes
0 answers
557 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 ...
klyd's user avatar
  • 223
6 votes
1 answer
1k 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-...
Mark Henderson's user avatar
6 votes
2 answers
7k 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 ...
Danny Tuppeny's user avatar
5 votes
0 answers
240 views

Powershell: How to read secure strings from textfile with windows service

I saved credentials of my vSphere environment to text files with the Powershell ConvertFrom-SecureString. I want to use this credentials in my powershell script using the following command: $...
TheWhiteJoker's user avatar
5 votes
1 answer
192 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 ...
SimonS's user avatar
  • 787
5 votes
0 answers
5k 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 ...
n0rd's user avatar
  • 181
5 votes
2 answers
5k 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 (...
Tarwn's user avatar
  • 151
5 votes
1 answer
5k views

Cannot initialize disk in PowerShell : Initialize-Disk throws "The disk has already been initialized"

I'm trying to change the flash drive's partition style to GPT using PowerShell, but the cmdlet throws "The disk has already been initialized" (even though I've cleaned the drive): PS C:\WINDOWS\...
Ark-kun's user avatar
  • 151
4 votes
0 answers
3k views

How to properly add .NET Core 3.1 assemblies to PowerShell session?

Related to this question: How to properly add .NET assemblies to Powershell session? I used this code to likewise try to load a .NET Core 3.1 assembly into a PowerShell session. I used this code: ...
Glenn Ferrie's user avatar
4 votes
2 answers
5k views

List the name servers in the DNS Zone properties GUI with Powershell

I have read through a listing of all the DNS powershell cmdlets and can't believe I didn't find a programmatic way of reading the below list. Am I missing it, or is there a .NET way to do so that I ...
user66001's user avatar
  • 213
4 votes
0 answers
2k 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))...
PorLosTacos's user avatar
4 votes
0 answers
3k 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 ...
Mike Christensen's user avatar
4 votes
1 answer
3k 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 ...
gregmac's user avatar
  • 1,609
4 votes
1 answer
4k views

Error in powershell: operation requires an interactive window station

I am executing below command through autosys(scheduling tool) to stop a service but it is failing with below error. The command works fine when i run the command on RUN(WIN+R) or cmd after RDPing into ...
srivastava's user avatar
4 votes
1 answer
3k 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 ...
bradford's user avatar
4 votes
0 answers
5k 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 ...
Rasmus's user avatar
  • 143
4 votes
1 answer
3k 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-...
semantic_c0d3r's user avatar
4 votes
1 answer
1k 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 {...
atownsend's user avatar
4 votes
1 answer
584 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 ...
Josh Graham's user avatar
4 votes
1 answer
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 ...
RobbieCrash's user avatar
  • 1,221
4 votes
1 answer
271 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 ...
Axeman's user avatar
  • 141
4 votes
1 answer
110 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 ...
jcolebrand's user avatar
4 votes
1 answer
675 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 ...
Matthias Güntert's user avatar
4 votes
1 answer
513 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 $...
Aaron Hall's user avatar
4 votes
0 answers
387 views

Query performance counters from powershell

I am trying this script to query performance counters in different localized windows server versions. http://www.powershellmagazine.com/2013/07/19/querying-performance-counters-from-powershell/ ...
Frane Borozan's user avatar
4 votes
4 answers
5k 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-...
pk.'s user avatar
  • 6,511
3 votes
0 answers
320 views

How to add/change NAPTR records to a specific ZoneScope in Windows DNS using PowersShell

I'm using DNS Policies in Windows DNS for split-horizon. I need to add NAPTR records which resolve differently based on the subnet of where the request came from. I've got almost all of it figured out,...
C Hamm's user avatar
  • 81
3 votes
0 answers
4k views

How do I fix 'Missing stored keyset' through a remote powershell session (without also being RDP'ed in)

I'm trying to script the installation of our on-premise CI/CD agent. Part of that is installing some certificates Powershell Import-Certificate -FilePath self_signed_CA.cer -CertStoreLocation cert:\...
dvdvorle's user avatar
  • 181
3 votes
0 answers
2k views

Why isn't SMB Direct working over RDMA?

In a Windows lab environment, I'm trying to test performance of SMB Direct using Mellanox RDMA adapters with global pause. I wanted to test first with Global Pause for simplicity before switching to ...
Elliott B's user avatar
  • 200
3 votes
0 answers
558 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 ...
frupfrup's user avatar
  • 863
3 votes
1 answer
3k views

Enable-Bitlocker -TpmProtector via GPO does not work (0x80070522)

I am trying to automate the bitlocker in our corporate environment. I have written a script which enables the bitlocker and it works fine if I run it manually, but whenever I implement it via GPO (...
2 B's user avatar
  • 39
3 votes
0 answers
1k views

Powershell: Listing billions of folders fastly

We have to check ALL ACLs (for an specific user) on a large UNC folder and some local folders with millions and millions of files. Get-ChildItem is painfully slow, so I am trying using the [System.IO....
JavierS's user avatar
  • 105
3 votes
0 answers
490 views

How do I SSH into a Windows 10 Powershell session with colors and tab completion configured from a Linux terminal?

The default on Windows 10 is to ssh into cmd.exe . If you type powershell.exe from there you get highlighting and tab completion. However, it is kind of flaky and laggy sometimes. If you ssh directly ...
Molly Stewart-Gallus's user avatar
3 votes
0 answers
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 ...
Deeh's user avatar
  • 131
3 votes
1 answer
816 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 ...
AnotherHowie's user avatar
3 votes
0 answers
2k views

Missing WSMan provider on PowerShell Linux (to use remoting)

I'm trying to remote PowerShell from Linux to a Windows Nano Server on Azure. There's a part in the instructions where I add the IP of the remote server to local computer's trusted hosts: PS > ...
joelanders's user avatar
3 votes
1 answer
2k views

Powershell remoting write event log as non admin

I'm attempting to set a non admin up with the ability to write events to the application log via powershell remotely. Remoting works, I can read the registry, etc. Just not write to the event log. ...
Tim Brigham's user avatar
  • 15.6k
3 votes
1 answer
1k 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. ...
Noob's user avatar
  • 363
3 votes
1 answer
147 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 ...
Kai Hatje's user avatar
  • 143
3 votes
0 answers
164 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 ...
Alexander Sinno's user avatar
3 votes
2 answers
287 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}....
Lloyd Smith's user avatar
3 votes
1 answer
3k 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> ...
Neetika's user avatar
  • 81

1
2 3 4 5
21