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.

Filter by
Sorted by
Tagged with
0
votes
0answers
8 views

Powershell: unable to create new Hyper-v VM remotely

To simplify our current setup. We have SRV01, SRV02, and SRV03. All Windows Server 2016 with Hyper-V installed and joined to our domain. SRV01 host a shared folder "\\SRV01\VM-ONLINE-STORAGE\Test&...
0
votes
0answers
11 views

Is it possible to install Windows Debugging Tools via Powershell?

I've installed LeanSentry on one of my web servers to try and diagnose some performance issues I've been having. I need to install Windows Debugging Tools (from the Windows SDK) to get some memory ...
0
votes
1answer
20 views

centralized powershell backup script

We're needing a powershell script to backup a folder from 3 remote servers: server1 server2 server3 same source path on each remote server: c:\backupfiles To a central local folder with today's date ...
0
votes
0answers
22 views

Powershell Import-Module doesn't work when in script

I need to import the ActiveDirectory module for one of my scripts. When I do this from the command line, running Import-Module -Name ActiveDirectory ./script.ps1 Everything works just dandy. But ...
2
votes
2answers
33 views

How to control which version of Powershell Puppet shells out to on Windows?

Microsoft recently changed their download repository for Windows Powershell to require TLS 1.2+ which Windows Powershell 5.1 doesn't support without the runtime setting change to Net....
0
votes
0answers
28 views

Powershell / Command prompt cannot switch to mapped drive when running as another use

in my powershell prompt, logged into a Windows 10 PC as Domain\UserA i can run the net use command to see my shared drives net use lists +--------+-------+----------------+---------------------------+ ...
1
vote
1answer
75 views

Powershell: install RDS Terminal Server Gateway SSL Certificate

I have a very simple Powershell script to renew SSL certificates. We are using short duration SSL and this is a repetitive process. On our TSG (Terminal Server Gateway), I automated the IIS ...
1
vote
1answer
32 views

Zabbix low-level discovery - CPU usage per process - two items with identical keys

I'm trying to use Zabbix for monitoring CPU usage by different processes on Windows Server. Processes to monitor are not determined upfront. I want to use LLD to monitor top 3 CPU demanding processes. ...
-1
votes
0answers
18 views

How can i get report from user that has completed a full scan using MS Defender

I'm new to powershell scripting and in the field of MS Defender. I have a request to collate result from user machines that has completed a full scan and info required are Get-MPComputerStatus, I have ...
0
votes
0answers
28 views

Trying to create a Powershell script to connect to a server via smart card

Sorry if this is in the wrong community but it seemed the best. My organization is trying to automate the commands that it has done manually before (Indexing computer storage, etc.). However, we use ...
0
votes
1answer
72 views

How can I secure erase a drive using Powershell?

Does Powershell have a built-in way to secure erase a disk? By secure erase, I mean writing random data or all zeros to the entire disk. By disk, I mean the whole physical disk, not individual files, ...
-4
votes
0answers
23 views

How to create folder on Desktop to all users in domain using GPO [closed]

How can I create a folder on Desktop to all users in domain via GPO? Path for the folder C:\Users%username%\Desktop\ExampleFolder I know how to do this with Group Policy manager, but I have to use ...
0
votes
1answer
43 views

Invoke-WebRequest $Url gets 200 status code even though the actual status code is 500 through browsers like IE or Chrome

I have a web page which returns 500 error through IE or chrome, but when I use PowerShell Invoke-WebRequest $Url -UseBasicParsing I get 200 status instead of 500 status code. Is there a difference ...
0
votes
0answers
15 views

Is there any builtin tool available in office 365 for powershell activity realtime monitoring? [closed]

I am looking for a tool to monitor real time PowerShell activity in Office 365 servers.
0
votes
2answers
52 views

Unable to extract full user list from AD OUs having 2000+ user accounts. Limited to 2000 users

I want to extract all users in Active Directory, using the following command. Few OUs have more than 2000 user accounts. Here using this command, I do get the users as desired but the users in the OUs ...
2
votes
0answers
24 views

Error exporting VM configuration

I'm attempting a config-only VM export using this script, which was originally posted nearly ten years ago. Hyper-V internals have clearly changed since then, as I'm getting an error message: Failed ...
-3
votes
0answers
32 views

Looking for a powershell script to automate bulk users into Active directory 2016

Looking for a powershell script to automate bulk users into Active directory 2016 with the following things creates a user name following this syntex FirstName.2characters from lasname exp,. Jake.br ...
1
vote
1answer
48 views

Powershell - Invoke-command does not run the msiexec.exe

I want to install the TortoiseSVN-client on a bunch of servers, using Powershell remoting. Basic operations work, but the below command won't work as remoting Invoke-Command -ComputerName myserver -...
0
votes
0answers
17 views

SCCM Add Collection into a Collection Powershell

i'm starting with powershell in SCCM, I connect into a site, and with $tete = Get-CMCollection -Name "XXXXXXXXXX" i can get: $tete.CollectionRules this last contains a lot of object like ...
1
vote
1answer
37 views

How can I kill a process remotely on a windows server when the server has exceeded its memory limit?

Context I use and manage* a windows server at work. It is used for general computations by up to 5 users at a time via RDP. The server has 128GB of RAM which is sufficient for the work we do on it. ...
1
vote
1answer
35 views

I am trying to use Windows Task scheduler to run a Powershell script

The problem is that when I use the following:- -noexit -NoProfile -ExecutionPolicy Bypass -command "& ' C:\Program File(x86)\WinSCP\WinSCP" /ini-nul/script=C:\Users\Glen\Desktop\WinSCP\...
0
votes
0answers
33 views

Converting an Excel/Exchange Online Powershell script into Azure Logic App / Azure Functions

I have a Powershell script that I'd like to convert to an Azure Logic App (or some other method of Azure automation) but I'm unsure of the best combination of Azure tools to use to achieve my goal. My ...
0
votes
0answers
23 views

parallel instances of Robocopy not getting CPU time

I'm trying to copy large directories from 3 sites. I noticed that robocopy was using < 25% of my CPU, I figured I can spawn 2 more instances in parallel to copy the other 2 sites. However, I am ...
0
votes
0answers
15 views

Office365 Create new spam bypass transport rule via powershell

I need to create a bypass rule for all of Proofpoint's IP's. When I attempt to follow PowerShell command to bypass Office 365 spam filter , it doesn't seem in inject anything into the rule. Or, it's ...
0
votes
0answers
16 views

Getting Current / Active session in Azure virtual machine using powershell(Runbook)

I'm trying to get the current active session in Azure VM through the Runbook PowerShell. If there is no any active session / usage then planning to stop the VM. The problem is, I couldn't able to get ...
2
votes
1answer
43 views

Preserving AD Configuration (User/Groups/OUs) After Uninstalling “Active Directory Domain Services” Role

I have somewhat of a unique challenge, I'm trying to migrate a old legacy server from a locally installed version of Active Directory Domain Service to a centrally managed AWS Directory Service. As ...
0
votes
1answer
20 views

How do you build an MSIX package from the command line

My end goal is to be able to run a Powershell install script in a VM and capture all the changes it makes into a MSIX package. I can do this manually without issue using the MSIX Packaging Tool wizard,...
1
vote
1answer
62 views

Can't query certain namespaces/classes in WMI (Get-WmiObject: Not supported)

I'm trying to query classes in the root\microsoft\windows\managementtools namespace, but am getting an odd error. I have confirmed this namespace exists on my machine, because I can query it using ...
0
votes
0answers
24 views

Copy a folder from one location to another location based on the Folder Name

I'm trying to copy a folder from one location to another location based on the Folder Name. I need to move the folder for each user (the username is on the folder name) to another location. For ...
0
votes
0answers
13 views

Settings to upload large file via WinRM and Copy-Item - Powershell

I´m trying to copy a large file (around 180MB) to a remote server using PowerShell Copy-Item. Copy-Item –Path "$sourcePath" –Destination "$destPath" -Force –ToSession $session It works for files of ...
0
votes
0answers
58 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: ...
0
votes
1answer
47 views

Powershell script to find AD user with firstname and lastname

I wrote a script to find users in AD using their firstname and lastname from a csv file. When i execute the script, I dont get any output. Also no error.... Please help if any issues with the script. ...
6
votes
1answer
72 views

Hyper-V Server VM stuck at boot and I cannot delete it

I am using Microsoft Hyper-V server with Admin center. Admin center says: VM Status: Paused-Critical Powershell says: VM status : In service. After server restart one of the virtual machines is stuck ...
0
votes
1answer
35 views

Running powershell as service account without logon privilege

I'm trying to run a powershell script as a service account via task scheduler. It has to run as the service account (rather than the local system) to get required permissions to do some of the tasks. ...
1
vote
1answer
136 views

Powershell: start and stop flask server

I wrote a powershell script to start my flask server, run my tests then stop my server. It starts the server and runs my tests. However, when it kills the $server process, it leaves the actual server ...
0
votes
1answer
60 views

Get-MailboxDatabaseCopyStatus Displays wrong status (Microsoft Exchange)

When I execute the Exchange command in powershell, and below command is executed before executing Exchange command. Add-PSSnapin Microsoft.Exchange.Management.Powershell.E2010 The "Get-...
1
vote
1answer
26 views

I want to delete 30 days old folder + sub folder by using Powershell were folder save in date wise

I want to delete 30 days old folder & all sub folder which name start "dba_20200312-0500311 - 123" # $curDateTime = Get-Date -Format yyyyMMdd-HHmmss, folder save in this date format $mydays = (...
3
votes
1answer
51 views

Active Directory ADSync error with non-existent account

I have a weird ADSync error stating that my local active directory contains two objects with the same ProxyAddress property. One of accounts is username@domain.tld (which is correct) and the second is ...
2
votes
1answer
238 views

How do I install an app from Windows Store using Powershell

I know if I have .appx package file, I can install it via powershell with the Add-AppxPackage cmdlet. However, I simply want to download & install Microsoft Store packages by name. I don't want ...
3
votes
1answer
93 views

Zabbix - UserParameter Powershell script item is 'not supported' - CPU per process monitoring

I'm new to zabbix and I'm trying to create custom User Parameter to Monitor CPU utility per process(Windows Machine). I have a powershell script and a user parameter, I also added a new item under ...
0
votes
0answers
30 views

powershell task in task scheduler cannot start-process with another -Credential

We have a scheduled task that is a powershell script. The script performs a number of actions against SQL data-bases where the access is controlled via integrated security. Hence each of these ...
0
votes
0answers
33 views

Test-WSMan works with localhost, but doesnt work with fully qualified domain name or Hostname

I have a windows 10 1909 Build 18363. Machine, following is what I am observing. This is all on an powershell with elevated permissions. PS C:\Users\mohit.thakral> Test-WSMan -ComputerName ...
0
votes
0answers
36 views

Set proxy.pac by script

In my company we are using a proxy that is set via a proxy.pac. Additionally to make life easier I am using a socks proxy via ssh to reach a special network area that is usually only available via a ...
0
votes
3answers
51 views

Kerberos second-hops using PowerShell Sessions

I often use PowerShell remote sessions to manage windows servers remotely, generally using the following command, though the following is true for any remote powershell commands such as Invoke-Command:...
0
votes
0answers
28 views

Connecting from Azure Automation to Office 365 PowerShell Endpoint fails half way through script

I have a script running under an Azure Automation account. The script connects to the Office 365 endpoint (https://outlook.office365.com/powershell-liveid/), and uses Set-Contact to update some ...
0
votes
0answers
39 views

Powershell script for automating performance center test execution and fetching result post execution

I want to achieve the below using either Powershell scripting(preferred) or javascript(Cannot install node.js to install any npm package) Execute test from Performance center Post run fetch the ...
0
votes
1answer
24 views

Powershell - Run SCP command from CYGWIN but also expand variables

I need to expand variables before running the SCP command as a result I can't use single quote. If I run the script using double quotes in Powershell ISE it works fine. But doesn't work if I run ...
4
votes
0answers
51 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 ...
0
votes
0answers
38 views

Script to get all users (local and AD) member of the local administrators group

I need a script to get local and AD users having admin rights on a server >= Win 2008r2 The output should be something like: type username ---- ---------------- local administrator AD ...
0
votes
1answer
22 views

Export & Import Distribution Lists O365

I've an Hybrid setup with Exchange On-Premise and O365. What i want to do is export Exchange On-Premise distribution list with members (what i already done it) with the following code (Found in ...

1
2 3 4 5
73