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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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, ...

1
vote
1answer
14 views

Can Desired State Configuration / DSC be used to configure a Windows 10 workstation

I couldn't find this on the interwebs and it seems like a obvious use case to me Is it possible run Windows Desired State Configuration / DSC on a Windows 10 workstation? For example, setting up IIS ...
0
votes
0answers
20 views

Powershell -searching thru eventlogs for a specific pattern

I am trying to research IIS service crashing. The eventlog I am trying to research has a very specific message: World Wide Web Publishing Service service terminated unexpectedly. Im trying to list ...
0
votes
0answers
11 views

PowerShell JEA RoleDefinitions Trusted Domain

This one may be a bit tricky, and may not be possible. I have a PowerShell JEA endpoint configured in my DSC. It runs fine. The trouble is the users that are listed in the RoleDefinitions section of ...
0
votes
0answers
25 views

Install Antivirus on Windows Server 2008 R2

So, I have a CIS Microsoft Windows Server 2008 R2 - Level 1 image that needs to have an Anti-Virus installed and set to scan every day. This must be done with PowerShell so I can fit it into the ...
0
votes
0answers
34 views

How to find what physical server my physical disk in a S2D windows cluster is attached

I have a mirrored S2D cluster setup, one of my drives has an IO error as evidenced below. How do I find what physical server in the cluster this drive is attached to? I've ran all sorts of commands ...
0
votes
0answers
13 views

Powershell / Powercli script Cronjob

I made a Powershell script which uses Powercli to create and delete snapshots on my two Esxi hosts, but for some reason the Cronjob isn't working. In the syslog I can see the following message: (...
0
votes
0answers
8 views

Somthing goes wrong with running powershell script in unattend.xml for windows server 2016

I am trying lunch powershell script in autounattend.xml but it dont works in windows server 2016 Script must work before first user (administrator) login <settings pass="specialize"> <...
0
votes
2answers
27 views

Powershell command to FTP a file from server to select PCs on a network

TLDR: I need to move a large file from a server to the desktop of multiple SELECT machines connected to it. Network topography: 1 Server 5 - 20 Connected PCs This topography is pretty standard ...
0
votes
1answer
44 views

New-MailboxSearch: Parameter cannot be found

We're running Exchange 2013 and attempting to follow Microsoft's example 3 for an eDiscovery search on Public Folders using the Exchange Management Shell: New-MailboxSearch -Name "Contoso Litigation" ...
0
votes
1answer
27 views

How to remove a disk using PowerShell

I've inserted a removable disk to one of the physical servers, then I ejected it, but it is still appears, as shown below: I've restarted the server multiple times, but it did not work. Is there any ...
1
vote
1answer
18 views

Exchange: New-EmailAddressPolicy Invalid Argument

I'd like to add a email address policy to my office 365 exchange online. But when I try to add the policy, I always get the same error. Command: New-EmailAddressPolicy -Name MyPolicy -...
0
votes
0answers
5 views

Display all mailbox calendars which a user has access to [migrated]

I would like to find out all the calendars which a user can currently access. I searched up the Internet and the closest answer I got is this: (get-mailbox) | foreach{Get-Mailboxfolderpermission (($...
3
votes
1answer
454 views

Capture who all have accessed shared folders in last week?

In Windows Server 2012 is there a way that you can retrieve logs (via Powershell) of those who accessed, modified or deleted shared folders in the last week?
0
votes
0answers
29 views

Powershell set env variable and get it within one session

having a script when the environment variable is set $env.Environment = "prod" but I would like to get it within one powershell session(from the same script) without restarting it. Is it possible? ...
0
votes
2answers
57 views

Set Owner by Folder Name Recursivly Powershell

I have a persmissions problem, on our Fileserver, where the NTFS Owner was not copied correctly, these are Citrix UPM Profiles, I found a script, for this but it does not work recursivly: $Path = ...
0
votes
1answer
17 views

Powershell script Import Users from CSV, add to group, with Success/Fail logs

I am attempting to create a powershell script to maintain users. Current environment. Office365 with ADFS, AD and on premise exchange server 2010. All integrated together. For the current problem, I ...
-3
votes
0answers
50 views

take ownership of file under C:\Windows [on hold]

I am trying to rename the ActionCenter.dll via our software deployment software. In order to do that I have to take ownership of the file. By default it is owned by TrustedInstaller The software runs ...
1
vote
1answer
44 views

Windows - Webserver cannot bind to port 80, but no known processes are using the port

Long time ago I have created a Powershell script that stops the Apache-service, delete the webserver logs and the start the service again. Have had no issues until recently when the stop-process has ...
1
vote
1answer
219 views

Obtain Message Tracking Logs

All, I need to determine if emails have been sent to an external address from our Exchange server. Unfortunately, there is no specific sender to target as there could be multiple people who sent ...
0
votes
0answers
30 views

How to query LDAP via port 636 from powershell?

I use adsi to connect to AD and measure the latency of the connection. For same query when i replace server with server:636 , it fails. What is the easiest way to do a ldap "find" through 636 port?
0
votes
0answers
21 views

Trend Micro Anti-Virus / Deep Security Unattended Installation

I would greatly appreciate if someone with operational knowledge about Trend Micro Deep Security, could verify or debunk the following statement: The software cannot be installed unattended client-...
0
votes
1answer
33 views

Scheduled powershell to replace batch file ends too soon or never ends

First I'll explain the context, because maybe I'm not doing it in the right way. We have an ERP developed using Oracle Forms 6i (yes, is really old). It has forms and reports. Reports have such ...
0
votes
1answer
22 views

Windows Admin Center Doesn't Connect

I've installed version 1804.25 of Windows Admin Center (WAC) onto my Windows 10 Pro v1709 laptop. I accepted the WAC self-signed cert, provided by the installer, on first page load. I then used the ...
0
votes
0answers
31 views

Set-WBPolicy: The Parameter is incorrect

When configuring a backup using Powershell in Windows 2016 Core, I am receiving an unintelligible exception. I have created a backup policy as follows: $policy = New-WBPolicy Add-...
1
vote
1answer
26 views

Execute a scheduled task on one (and only one) domain controller

I am setting up an Active Directory domain. It includes some Linux servers that use sssd to access the users and groups of the domain. Because the users and groups need a UID and GID for that (I don'...
0
votes
0answers
22 views

Server 2008R2, startup/shutdown powershell scripts in gpedit.msc not working and not appearing in registry. Script works manually. No domain involved

It's a fully updated 2008 R2 box running WMF 5.1. I've got a powershell script that, under normal circumstances, e-mails me on startup or shutdown. It's working fine on a different 2008 R2 box. On ...
0
votes
2answers
25 views

Powershell script to detect when a hot spot is in use and edit the registry

We have a situation where a number of Reps use there iPhones as hot spots. Not a problem on it's own. However, to prevent over use of data we would like them to Set the Wifi point as Metered when ...
0
votes
1answer
44 views

PowerShell copy-item error catching

how do I go about catching errors if this fails and output them to a .txt log file? $ErrorActionPreference = 'stop' #source1 file location $source1 = "C:\users\me\desktop\test1" #dest1 file ...
-1
votes
0answers
32 views

How to add Port Number to output [closed]

I am using this script to obtain orphaned process. $all_Processes = gwmi win32_process -ComputerName . | select ProcessID,ParentProcessID,Description,@{l="Username";e={$_.getowner().user}} | where{$_....
0
votes
1answer
15 views

task scheduler returns false executing the script

The following script checks for network share availability: while($true) { $i++ test-path Z: |Foreach{"{0} - {1}" -f (Get-Date),$_} | Out-File "F:\script\path.log" -Append Start-Sleep -s ...
0
votes
0answers
16 views

Updating Active directory from Microsoft cloud to server

I'm working with cleaning up in our Active driectory after we have moved over to use Microsoft cloud in our company. My job is to go through all the groups in our ou's on the Active directory server ...
0
votes
1answer
32 views

install powershell gallery module using puppet

Hopefully this is the right place for this. i am using Puppet on Windows Server and looking to install a Powershell module found in the Powershell Gallery using Puppet. I have read through https://...
0
votes
1answer
34 views

What's the difference between Start-Service and Set-Service -Status Running?

I was changing a service from a disabled state to a running state with the startup type as automatic on a bunch of servers, and I was poking around online on how to do it remotely, and using Set-...
-1
votes
0answers
28 views

Can you generate a certificate enrollment request on one machine and complete it on another? [duplicate]

I have recently been tasked with automating our certificate issuance/renewal process via PowerShell. Having never worked in this space prior, I'm doing a lot of on the fly learning. Please excuse my ...
0
votes
0answers
24 views

Additional Outputs Based On Group Memberships

I hope you all are having a great day. I apologize in advance if this is a terrible attempt at a question, I'm not very good at this. I was also recommended by a user on Stack Overflow to post this ...
0
votes
1answer
57 views

Terraform GCP: Remote execute PowerShell in Windows instance on create

I have made a simple Terraform manifest that successfully initiates a Windows 2016 instance in GCP. As a next step I would like to execute a Powershell script to further configure and install software ...
0
votes
0answers
58 views

powershell get-aduser query to grab all groups with two strings

Main purpose is to get a list of all Active directory groups that pertains to my work location within the corporation. I have two strings to search for. DC## (which is the DC I work at) and ...
2
votes
1answer
54 views

How do I use Get-AdObject with an -LDAPFilter on proxyAddresses?

I'm trying to search for SMTP addresses using an LDAPFilter on ADObject Get-AdObject -properties * -LDAPFilter "(proxyAddresses=alert.haveibeenpwned@test.edu)" I understand that some of this is ...
0
votes
1answer
41 views

Office 365 In-Place Hold preventing me from deleting user

I am using AD Connect to synchronize my on-premises Active Directory to our Office 365 tenant. I tried disabling a user from on-premises and then synchronizing to O365. However, it seems to have ...
0
votes
1answer
46 views

Out-File : Cannot validate argument on parameter 'Encoding'

I've got an automation script that I'm writing, and within it, I'm logging actions to a text file. I've generated the $logFile name with: $logFile = "\\server\e$\LogPath\log-$(Get-Date -Format '...
1
vote
1answer
29 views

Configuring TLSSendDomainSecureList for Exchange Online with PowerShell

We are replicating an on-premises setup on Office 365. As per https://docs.microsoft.com/en-us/powershell/module/exchange/mail-flow/set-transportconfig?view=exchange-ps the command Set-...
0
votes
1answer
29 views

Show group name for members of all groups containing Administrators

I need to get members of all groups which name contains Administrator $role = Get-AzureADDirectoryRole | Where-Object {$_.displayName -like '*Administrator'} Output: $role.objectid 4ab7edc2-...
3
votes
2answers
103 views

Can I RDP through mstsc and run a script on that remote desktop?

I'm writing a powershell script which needs to RDP to a few servers and do processes there and then come back. mstsc /v:<computer> by itself looks great as it's security/credential prompt is ...
0
votes
1answer
100 views

Get PowerShell command output as a variable in bat (cmd) script

I'm trying to get FQDN of a host in some .cmd file. We have disjointed AD domain so "@echo %COMPUTERNAME%.%USERDNSDOMAIN%" does not work. I mean it works, but returns wrong value. The solution I ...
0
votes
2answers
116 views

Query Active Directory UID attribute

I am trying to get a list of UIDs (NIS attribute). The problem is that UIDs are not in order. I would like to define a range and check if an account exist with that UID and if it does then get me the ...
0
votes
0answers
37 views

Adding to security group to computer [duplicate]

I'm using powershell to create AD computer objects. On those objects, I need to give premisions for certain groups in my domain. I'm trying to add the groups under the "Security" tab and not "Member ...
0
votes
0answers
58 views

How to set a PromiscuousMode on Network Adapter using Powershell in WIndows Server?

It's easy to check state of the PromiscuousMode for a physical network interface using PowerShell: Get-NetAdapter | Select InterfaceDescription, PromiscuousMode However how to set (enable/disable) ...
0
votes
1answer
39 views

How to add security group to a computer using Powershell

I hope I can explain myself well :) I'm trying to create a script that will allow me to create AD computer name in a specific OU, and then add a Security group to this computer, under the "security" ...
0
votes
0answers
57 views

PowerShell Copy-Item from Remote Session

I am able to transfer files to a remote session, however I been pretty unsuccessful at retrieving files from it. The remote system is a Windows 7 machine with PowerShell v2.0, from Windows 10 ...
0
votes
1answer
119 views

powershell Set-Content : A parameter cannot be found that matches parameter name 'NoNewline'

New to powershell and basically have plagiarize the following script to scan through a list of html files to remove unnecessary commas. I only get an error when running this on the server. Could use ...