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
1
vote
1answer
22 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
34 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 ...
1
vote
1answer
43 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 ...
2
votes
0answers
19 views

Monitoring CPU per Process Utility using zabbix agent

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
16 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
24 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
16 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
33 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
17 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
38 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
17 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
42 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
28 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
20 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
vote
0answers
23 views

Issues with LAPS

For the past three hours I've sat at my desk ready to smash my Dell R710 in with a baseball bat. After installing all features of LAPS and running import-module AdmPwd.PS, I can't seem to get AD to ...
0
votes
1answer
36 views

Powershell Exchange Add-MailboxPermission

The command Add-MailboxPermission is not working. It is giving me the error: Cannot find information about the local server server.domain.com in Active Directory. This may be related to a change in ...
0
votes
1answer
25 views

Get the previous day date as variable in batch file from powershell command output

The scenario is like this. I need a previous day date (i.e. Today -1) as variable in a batch file. But if previous day is Sunday (i.e. script running on Monday) it should return the Saturday's date (i....
0
votes
1answer
48 views

Unable to forward messages from outlook to gmail

https://docs.microsoft.com/en-us/exchange/recipients/user-mailboxes/email-forwarding?view=exchserver-2019 I referred the above tutorial to setup email forwarding in exchange. It was working fine when ...
1
vote
2answers
33 views

Connecting to BOTH Compliance and Exchange online in Powershell using Modern Auth

In the world of basic authentication, I used to connect to MSOL, Compliance and Exchange in a series that went like this: function ConnectToCloud() { $CloudCredentials = ...
1
vote
1answer
40 views

Add Network Adapter to VM in vCloud Director using PowerCLI

I am using the PowerCLI version 12 and have a VM which currently has no network adapter. There is the Cmdlet Get-CINetworkAdapter but that returns null (because there is no adapter) And there is Set-...
0
votes
2answers
115 views

Cause of Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes

Steps Launch PowerShell 7 on Windows 10. Actual result PowerShell 7.0.0 Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/powershell Type 'help' to get help. Warning: ...
0
votes
0answers
40 views

How to alter the version of Powershell that loads on “powershell” command?

BACKGROUND: I'm learning Powershell. Attempting to create scripts and execute commands involves a certain amount of trial and error for someone of my limited experience, and I therefore find it ...
1
vote
1answer
46 views

Modify Multiple Files Names with PowerShell in same directory

I'm a complete noob when it comes to powershell but I've been struggling with this one all day and not sure why. Each day, I will have a set of files in a directory. The files will be different ...
0
votes
0answers
21 views

Azure - Trying to gather update details from log analytics accounts for all my VMs

I'm trying to compile a list of all my VMs over all subscriptions with details on windows updates missing, the last critical patch applied, last scanned date/time. I've got as far as listing all VMs ...
6
votes
1answer
57 views

Powershell disk management

Welcome, I have question about managing disks via Powershell. Is there any possibility to (like in DISKPART) - change type of disk to dynamic, - create mirrored disk, - create raid-5 volume, - extend ...
2
votes
0answers
63 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 ...
0
votes
1answer
28 views

Exchange Online Powershell Set-HostedContentFilterPolicy - A positional parameter cannot be found that accepts argument 'â€BlockedSenders

I have a custom powershell script that connects to Exchange Online and tries to add spam email addresses & domains to the custom Content Filter Policy. The script is: # Blocks Spammers - Email ...
0
votes
2answers
42 views

Get name of OWA (Outlook Web Access) Mailbox Policy name applied on a mailbox?

I want to get the name of OWA Mailbox Policy enabled on a mailbox. Using Get-CASMailbox command I'm able to know either OWA policy is enabled on a mailbox or not but unable to get the name of OWA ...
0
votes
1answer
49 views

How to create Windows simple storage pool?

In Windows Server 2019, I am trying to create a simple storage pool with 6 disks using Powershell. The total size should be about 42 TB, but it creates a pool of only 1.23 TB. The rest is still part ...
2
votes
2answers
46 views

What is this scripting and how it is using .NET 4.5? Is it C# scripting? PowerShell Scripting? VBA Scripting?

What is this scripting and how it is using .NET 4.5? Is it C# scripting? PowerShell Scripting? VBA Scripting? I've found this answer in another question and was curious about it. As it's using .NET ...
0
votes
1answer
20 views

Command Line Control of Printer Preference Defaults

I have a set of (Ricoh) printers I want to deploy to my users on Windows 10. (As local TCP/IP Printers). The Computers are not part of any domain. I want to use the locked print feature so that my ...
2
votes
2answers
81 views

Set default data encryption policy in exchange online

I have recently enabled the customer key on my o365 tennant. I have been able to set my mailboxes DEP with the following : Get-Mailbox | Set-Mailbox -DataEncryptionPolicy "MyDEPPolicyNmae" Now I'm ...
0
votes
1answer
20 views

FileSize column empty in Powershell files listing [closed]

I have windows 10 (Ver 1909). When I issue following CMD, it works fine with proper FILESIZE column. Win 10 PS version: Major Minor Build Revision ----- ----- ----- -------- 5 1 ...
3
votes
1answer
113 views

How do I delete an incorrect cname record in Windows Server 2019?

So I mistakenly create a cname record in my Windows 2019 server. It is set in this naming context - server.company.local.company.local I know, silly mistake. It does not show up in DNS mmc but ...
0
votes
0answers
29 views

Why does OpenSSH on Windows ignore my environment file?

C:\ProgramData\ssh\sshd_config has this setting (and I have restarted the sshd service since setting it): PermitUserEnvironment yes My default shell (registry key Computer\HKEY_LOCAL_MACHINE\...
0
votes
0answers
25 views

Export all Azure subnets in all Subscriptions

I have been attempting to get a CSV of all vnets / subnets in all of my subscriptions. Is there a better way to do this? My first time with HashTables Thanks In Advance! $now = Get-Date -UFormat "...
0
votes
0answers
30 views

How to execute WebAdministration cmdlets on Powershell x86

I am trying to run Get-Website cmdlet in Powershell(x86) on Windows Server 2012 R2 Standard 64-bit operating system. I get the following error. $webSite1 = Get-Website -Name "Default Web Site" Get-...
0
votes
0answers
14 views

Powershell - Set parameter optional and let other params be at its position (0)

How to make a parameter optional but if the first param ($options) isn't specified, then use next param ($controller_id) at position 0. The use case of param $option is very limited. I don't want to ...
0
votes
0answers
23 views

How to add AD Group to SharePoint Group using Powershell

I use claim authentication for sharepoint 2016. AD group are Security Group - Domain Local. I took this code that was on this forum (santosh kondapalli), but does not work for adding AD group. https:...
0
votes
0answers
15 views

disable auto windows update for server 2016 using powershell to change registry key

I am trying to disable windows auto update by changing the registry key value for a VM. I have modified the 'NoAutoUpdate' key to 1 using below statement. set-ItemProperty -Path HKLM:\SOFTWARE\...
2
votes
1answer
69 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 ...
0
votes
0answers
16 views

Get-BpaModel Powershell cmdlet fails on “Microsoft/Windows/DirectoryServices” with index out of range error

Get-BpaModel enumerates through all available bpa models. I run it from one of our dc with domain admin privileges. It started to fail today on fourth model (it enumerates ADRMS, CertificateServices ...
1
vote
0answers
72 views

Powershell Get-DnsServerResourceRecord seemingly returning all name servers in every zone, not just for the one specified

I have to check and then potentially update up to 400 zone nameserver records. I thought I could turn to Powershell to do this in far less time, and eliminate any mistakes that would no doubt happen ...
0
votes
0answers
23 views

Json object from power shell

I am trying to create JSON object from power shell $var6 = '{ "key5": "value5", "key4": [ "$Version" ], "key1": "value1", "key3": "value3" "key6": ...
0
votes
0answers
54 views

Unjoin Domain fails unless Domain Controller is offline

I have a domain controller setup for testing purposes with one Windows 10 workstation joined to the domain. Let's say I want to remove the current DC and deploy a new one with the same IP, but a ...
0
votes
0answers
19 views

RDP Stuck using powershell script / errored out

$Cred1 = New-Object -TypeName pscredential -ArgumentList "domain\user",(ConvertTo-SecureString -String 'password' -AsPlainText -Force); $servers= Get-Content "C:\Packages\Values.txt" Function ...
2
votes
1answer
140 views

Extract OU name using Powershell's Get-ADOrganizationUnit & Get-ADComputer

I want to get a list of servers on our Active Directory, I also want to include their IP, OS and what Organization Unit they belong to. It is the direct parent OU from which my servers belong to I ...
1
vote
2answers
69 views

PowerShell script error: the RPC server is unavailable

Im slowly getting my feet wet with Powershell, so I am a new beginner. Trying to have PS pull from a text file a list of PCs and let me know the status of their App Identity Service. The basic ...
0
votes
0answers
36 views

Windows Container on EC2 unable to connect to http://169.254.169.254/latest/meta-data

Cannot figure out why my docker container running on Windows Server 2016 is not able to hit AWS instance metadata endpoint for its host. On Linux I do not encounter these issues with pulling the ...
2
votes
1answer
32 views

Windows 2016 powershell and NuGet Errors

I am trying to install the Windows 2016 RDWeb HTML5 client on a Windows 2016 RDGW server using these instructions from Microsoft CLICK HERE I was able to successfully do this on one of our regional ...

1
2 3 4 5
72