Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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
vote
0answers
6 views

Powershell, how to compare user input

I'm making a "shortcut" PS1 script to update a domain user's password. I'd like to prompt the user for the new password twice without showing the password on screen. When I use $Text1=Read-Host ; $...
0
votes
0answers
12 views

Collecting NIC teaming information on Server 2008 R2/PowerShell 2

Is there a way to do this via WMI? I've collected info but am not sure what to look at as far as identifying interfaces as set up with teaming. Nearly all the servers that have teamed interfaces ...
1
vote
1answer
29 views

Powershell send-MailMessage Exception

My script for sending emails using Office365 with an admin credentials. The script worked about 6 month, ago but recently it has not been working although it has not been changed. I have tried to ...
0
votes
0answers
23 views

SCOM maintenance mode trigger based on PowerShell script on client

Appreciate any suggestions with this, I am looking to make a scom configuration in such a way that it monitors for a PowerShell script deployed onto a server and puts that server to maintenance mode ...
0
votes
1answer
19 views

How to query for AutoMapping on 0365 Mailbox using PowerShell

I can enable and remove AutoMapping on a user/mailbox, but how can I query for it using powershell? I've looked for the properties in Get-MailboxPermission, Get-Mailbox or Get-AzureADUser but couldn't ...
0
votes
0answers
16 views

Unable to connect to Azure RMS through Azure Cloud Shell

Folks, I am having Azure free subscription,and used it to connect to RMS service using Cloud Shell. I imported the PowerShell module using the command Install-Module -Name AADRM . Post executing ...
0
votes
0answers
14 views

Powershell - Session Disc not found

I am using the following command to kick a user out of their session on a Terminal Server: Logoff $id /server:$serverName Where $id is their session id and $serverName is the name of the server. I ...
2
votes
1answer
87 views

Why does my DNS MX query return an SOA record?

I am using PowerShell to get an array of MX records. I am wondering why the following command would return SOA records as I have specified MX for the type parameter. Resolve-DnsName $SomeDomainName -...
0
votes
1answer
65 views

change email address script + guidance

We have a tiny company that is currently with @xxxx.com and the brand changed to @yyy.com Can someone give me few guidance on steps to create a script that will change all of the @xxxx.com addresses ...
1
vote
1answer
70 views

How to use PowerShell to check WSUS updates status

Usually I get a list of Windows updates KB numbers which I have to check the approval status on WSUS server for. So for me it is very annoying (and time consuming) to open WSUS console and then ...
1
vote
2answers
49 views

reading a csv file in powershell , header line having duplicates

I have a script I am trying to read a csv file with and assign column names to the data. however the files has multiple columns named the same see below Grade QA/QC and Symbol ID,Date,Water Level / ...
0
votes
1answer
43 views

Download OpenVPN client using Azure Powershell?

I'm a learner of Azure Powershell and I want to download the VPN profile for the gateway using Powershell. As per Microsoft this can be done with New-AzureRmVpnClientConfiguration but could not find ...
0
votes
1answer
28 views

PowerShell New-FSRMAction “property out of range”

I am trying to build a simple variant of the "ransomware canary," where FSRM watches a directory, and if there are any changes at all, it immediately shuts down the computer. Here is my PowerShell ...
19
votes
2answers
2k views

How can I programmatically cause a new Windows user's profile to be created?

I'm creating a (local) user for a Windows service to run as. I've got good reasons for not wanting to use NETWORK SERVICE, LOCAL SERVICE, or LOCAL SYSTEM. I create the user via net user foobar "...
0
votes
1answer
26 views

PowerCLI - Get Active FC Path WWN of all datastores

I need to turn off one of the FC switch for maintenance. To turn off the switch smoothly, I want to set the manual path selection mode and switch all datastores to the second switch. I have a lot of ...
0
votes
1answer
298 views

How do I use Get-PhysicalExtent on Get-PhysicalDisk?

No matter which server I try the PowerShell docs for Get-PhysicalExtent on, nothing works. I've documented this as a bug on GitHub: https://github.com/MicrosoftDocs/windows-powershell-docs/issues/514 ...
0
votes
1answer
20 views

Command line HDD to VHDX

Is it possible to create a Windows shadow volume copy of an HDD to a VHDX using powershell? I got as far as simply creating an empty VHDX $disk = New-VHD -Path "d:/test.vhdx" -Dynamic -SizeBytes ...
0
votes
1answer
261 views

How to tag an EC2 instance on creation

Deploying EC2 instances using AWSPowerShell, I find myself unable to apply tags on instance creation using the -TagSpecification parameter in New-EC2Instance. I am generating tags dynamically and the ...
0
votes
1answer
31 views

Compter Management & Shared Folders

I'm trying to get a list of all "Volume Paths" for all shares on a remote NetApp server through PowerShell. WMI, CIM, WMIC, NET VIEW, NET SHARE, NET USE. I haven't been able to use any of those to get ...
0
votes
1answer
35 views

Uninstall Office Updates that were installed on a certain date

I'd like to uninstall some Windows updates that seem to be causing trouble with Outlooks search function. The updates were installed yesterday, so my approach would be something like "List all updates ...
2
votes
2answers
69 views

PowerShell 5.1 not working properly on Windows Server 2012

For some PS script, I need Get-ChildItem to work with '\\?\...' I tried with the original version, 4.0, but no luck : Get-ChildItem : Illegal characters in path. I tried on my PC (Win 10 1703) and ...
1
vote
1answer
36 views

Get-ADUser missing msExch attributes when using filter all

I'm a domain admin trying to create an export of all AD users, recording all msExch attributes (Exchange 2010). The following works fine: Get-ADUser <sAMAccountName> -Properties * | Select ...
-1
votes
0answers
30 views

How can I escape several quotes in a command

I am trying to run a command and keep getting an error because I cannot escape the characters that I need to. If I run this command in a command console I can run a command on a remote machine in ...
0
votes
1answer
43 views

Link Between NAT VMSwitch and NetNat Windows Powershell

Would really appreciate if someone can answer this for me it's been bugging me for a while. I've been going through documentation and articles on creating virtual nat switches and I have the process ...
0
votes
0answers
27 views

Update Group Policy via Batch Script or Powershell Windows 7

I administer about 300 remote computers (all across the country) that are on Windows 7 Pro (32-bit) and I need to change the Group Policy. This is the first time in 5 years I've had to change the GP. ...
2
votes
1answer
69 views

PowerShell font deploys for 1809

With the 1809 user font support in outlined here and here the method I've used in the past for doing administrative installs of fonts no longer functions, instead installing the font only for specific ...
-1
votes
0answers
12 views

powershell access denied google cloud control

I added a firewall rule to allow access on port 5986 but when I try to connect with my Google Cloud credentials and I am an owner, I get access denied. Below is the command I am using to connect. $...
0
votes
1answer
26 views

Remove Specific Recycling Time For IIS With PowerShell

We need to keep an IIS application pool alive as long as possible for long processing. The app pool in our std config has a 03:00AM restart in the array. I need to remove this. I can do it manually ...
0
votes
1answer
108 views

Use robocopy to only copy files not folders

I am trying to write a script that copies all files in my source folder to another folder but without the folder structure, so just the files. So far I have: robocopy "<source>" "<target>...
0
votes
1answer
17 views

Set-AuthenticodeSignature -TimestampServer with HTTPS?

In some of our environments we would like to use the TimestampServer option when signing so we don't have to worry about re-signing certificates. The issue we have is that in some environments we don'...
0
votes
1answer
37 views

Updating Expiring Keys - Azure OS Disk Encryption

Whilst day dreaming at my desk this morning, something occurred to me and I have not been able to find an answer of yet. So I am hoping someone may shine some light for me or just have a good ...
0
votes
0answers
59 views

Wrong password during pfx certificate import Windows(10, 2016)

I've tried to import a *.pfx certificate and I get an error about "Wrong Password". The error only appears on some systems. I've tested this on a few Windows 10 computers and on one Windows Server ...
0
votes
0answers
71 views

How to add RAS / EAP Credentials in Windows, in non-interactive, batch mode?

I want to make a fully automatic VPN client that does not require to enter a password through Windows GUI. The server to which VPN will connect is configured as IPSec IKEv2 VPN with EAP-MSCHAPv2 ...
0
votes
0answers
25 views

Windows Server Automate installation

I've run out of ways to try this so I hope you can help. I am trying to automate the setup of Remote Desktop Services on a Windows Server 2016 machine. The command I need to run is this: New-...
-1
votes
0answers
27 views

How to get metadata from Powershell Get-Package cmd?

I am trying to dump installed software information from remote computers. I have used Get-ItemProperty cmd on remote registry before but I know there is a latest Get-Package cmd which does a better ...
1
vote
0answers
39 views

Run PowerShell as elevated for another user

I am trying to run a command as the Admin user with elevated permissions but PowerShell doesn't support this method. Start-Process -FilePath "powershell" -ArgumentList "-Command New-...
0
votes
1answer
37 views

New-MailboxExportRequest error- isn't within your current write scopes

I'm running a command to export the mailbox of a particular user based on some conditions. Account I'm logged in with is already have role Mailbox Import Export Command- New-MailboxExportRequest -...
0
votes
1answer
41 views

Get-AzureStorageContainer Powershell Command Adding Additional Text

I'm trying to run a powershell command to list the blobs in a container. I found this command and modified it as needed: $ctx = New-AzureStorageContext -StorageAccountName [name].blob.core....
1
vote
1answer
25 views

Scheduled task to run PowerShell failing specifically with Set-Service

I have a script which, when ran manually, works just fine. When I configure it to run as a scheduled task though this portion of the script never completes even though task scheduler marks it as ...
1
vote
2answers
402 views

Invoke-Command fails to create new VMs

I created this script to create multiple VM's remotely on the Hyper-V server, however, it doesn't seem to create the VM's. I can create one directly on the Hyper-V server using the given parameters ...
1
vote
1answer
70 views

Creating a new AD LDS instance without the Setup Wizard?

Is the installation of a new unique instance of AD LDS (using either cmd or PowerShell) possible? All resources I can find online just use the Active Directory Lightweight Directory Services Setup ...
1
vote
1answer
17 views

Can't copy file on local share using PS

Trying to zip folder on server and save it on another shared folder, invoke-command -Credential domain\Oleg -computername 'server1' { add-type -AssemblyName "system.io.compression.filesystem" [io....
-1
votes
0answers
34 views

Create certificate trust list (CTL) from command line (windows server 2016)?

How do i create CTL from command line in windows server 2016? This is usually done with certmgr.exe certmgr /add /ctl but i don't have this file.
2
votes
1answer
26 views

Converting Microsoft Security Essentials DateTime in registery to readable format

I am trying to get some data from the Windows Registery using Windows Powershell (5.0+), specifically data of Microsoft Security Essentials. I managed to decode almost all of it and convert it to a ...
3
votes
1answer
47 views

Last powered off date for a vm in Hyper-V 2016

In Hyper-V 2012 when we had the configuration of a vm in the xml format, one could look up the last_powered_off_time node in the vm's configuration .xml file: <last_powered_off_time type="integer"&...
1
vote
0answers
36 views

Running a command in Powershell and running the exe gives different results

This is really odd. I have a so called Perforce Helix server on my Windows 2016 server. Now on this server there is an exe called p4d now if i go to the Powershell and run p4d it runs the command ...
0
votes
1answer
46 views

How to filter the content of Powershell script output?

I need to capture the result of MSSQL Queries in Ansible output however, there are no supported Ansible modules which help me to achieve this. As a workaround, i have written a powershell script which ...
0
votes
0answers
50 views

office 365 enable AD sync after disabling

To me this is a rather weird issue, I've managed to complete exactly what I wanted to do, however, I'm now at the stage I want to enable AD sync again. The error I'm getting is as follows: PS C:\...
0
votes
1answer
39 views

Restoring SQL databases with an AzureRM Custom Script Extension

I am trying to download and restore database backups against a SQL server with an AzureRM custom script extension, the files download fine but restores fail with access denied ('for database 'master'),...
1
vote
1answer
35 views

Something missing for PowerShell install Printer

I am trying to prepare a PowerShell script to install printers. This will be for an automated task where printer names and IP addresses will be provided as available. Most of the script appears to ...