All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
235 views

Get all computers running specific Windows OS

I'm currently in the process of upgrading all Windows 2012R2 and 2016 servers to 2019. I would like to run a Powershell cmdlet that will get all the computers on the domain that are powered on, and ...
Vidarsskjalf's user avatar
0 votes
1 answer
535 views

Could not establish WMI connection access is denied

I set up a lab to test domain joining multiple computers with a script from Microsoft. After I ran the script it came back with could not establish a WMI connection with the computer with the ...
Hagen_21's user avatar
0 votes
1 answer
277 views

How to run PowerShell scripts remotely on old servers (2012 and 2012 R2)?

I've been running remote scripts on newer VMs (2019 and 2022) but now I have to run my scripts remotely on older VMs as well. It looks like PowerShell Direct is not available on older Windows Server ...
noobie's user avatar
  • 101
1 vote
0 answers
332 views

Remote shutdown with a shutdown reason code

I'd like to power off a remote machine by Stop-Computer command in PowerShell. Is there any way to send a shutdown reason code (like Hardware: Maintenance (Planned)) as if choosing during local ...
yildizabdullah's user avatar
-1 votes
1 answer
3k views

Handle exception with long paths in Powershell

I am new here and I facing issues with my powershell script whith long paths. This script aims to get relative path and hash from files/folders and its subfolders. It works with some with others I get ...
ed7's user avatar
  • 1
1 vote
1 answer
205 views

Retrieve parent folder size for each IIS site

Im trying to get a list of sites from IIS (8.5) to include the folder size but cant get this to work. Below is the current code i have that is working without the size Import-Module webAdministration #...
Computer's user avatar
  • 111
0 votes
0 answers
898 views

Executing a PowerShell Script With Spaces in Arguments via Task Scheduler on Windows Server 2012

I'm attempting to create a scheduled task on Windows Server 2012 that will execute a powershell script that will create an archive of a specific directory once per day. The arguments to execute the ...
Daniel's user avatar
  • 121
-1 votes
1 answer
256 views

Windows AD OU Block (Read/List) Objects from other OU

I have a Root OU that has an OU called "Clients" and under I have multiple OU's and the client's PC's/User Accounts in sub-OU's. The issue is, my clients can see other groups' user accounts/...
Lance's user avatar
  • 1
0 votes
1 answer
1k views

PowerShell - Remove User/Group from Security Permissions

I have an AD group called "Admins" and it has specific members but under the Security Tab, how can I use Powershell to remove certain users/groups from the Security list and/or modify the ...
Lance's user avatar
  • 1
0 votes
1 answer
1k views

How to find recently joined computers in ActiveDirectory through a PowerShell command?

How can I find recently joined computers in ActiveDirectory with a PowerShell command?
temesgen berhanu's user avatar
1 vote
0 answers
97 views

Why is my PowerShell script terminating too quickly?

Hoping you can help me I have a very simple python script which sole purpose is to go through a load of excel workbooks and get the data and produce a single file from it. Script works great. I then ...
Mike P's user avatar
  • 11
1 vote
1 answer
203 views

Disconnected disks-Access denied, showing in explorer, but not showing in DISKPART and unable to remove them

I have Virtual machine (terminal WIN2012), which seems to have under some users connected some OLD and NO longer connected disks (local or network drives), which are not accessible for anybody (even ...
Jozef's user avatar
  • 79
0 votes
0 answers
514 views

Deploy a PowerShell Script through a GPO

I have created a PowerShell Script that creates a VPN profile and applied it to a computer through a computer based GPO using a Security filtering. Through Gpresult on the target computer I can see ...
Alain's user avatar
  • 53
4 votes
2 answers
13k views

Restart-Computer : Failed to restart the computer with the following error message: A system shutdown is in progress

I have installed updates on my Windows 2012r2 Machine and as usual, I did a reboot. However, it seems that the machine has hung itself during the reboot process and does not do a proper shutdown. I ...
Orphans's user avatar
  • 1,406
2 votes
1 answer
735 views

Can I create a policy to disable a computer or user at a certain time?

Windows domain. We close at 5. I've been asked to disable certain computers/users at 5:15. I know how to restrict access to the file system on the hour, but a) that doesn't give enough grace time or ...
BWhite's user avatar
  • 143
1 vote
0 answers
315 views

Least Privileges for Windows Scheduled Tasks

I want to configure a Windows Server 2012 R2 and a Windows User (Active Directory Domain) in a way that the user has least privileges to access (read) a windows scheduled task on a remote windows ...
Johannes B. Latzel's user avatar
0 votes
2 answers
38 views

How to receive an alert when a Windows Web server running IIS with no internet or SMTP connectivity is restarted?

I have 3 web servers, and I have little control over the antivirus that keeps restarting the machine at around 1am. This causes a critical program to stop running and I'm only aware of it in the ...
Sean's user avatar
  • 1
2 votes
1 answer
59 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 ...
David Rogers's user avatar
0 votes
0 answers
6k views

Access denied issue with NEW-PSDrive commandlet

I have two machines: Machine A(Windows Server 2012 R2) and Machine B.(Windows 10) We use Machine A to host an ASP.NET Web application, Machine B is my development machine Both A and B are behind a ...
Chedy2149's user avatar
  • 223
2 votes
2 answers
757 views

Error enabling RDMA on Windows Server 2012 via Powershell

I am trying to enable RDMA on a virtual Windows 2012 server. I have tried the following commands but I keep getting an error. Enable-NetAdapterRdma -Name "Ethernet" And Set-NetAdapterRdma -Name "...
Jim Miller's user avatar
5 votes
1 answer
13k views

Powershell not able to access packages / "NuGet" package provider after security configuration update [closed]

I updated a server with a mof / dsc configuration, essentially changing various permissions / registry keys for security compliance. This was autogenerated to some degree, I do have a list of ...
e wagness's user avatar
  • 101
1 vote
1 answer
2k views

Running scheduled task on remote server

We have 3 scheduled tasks that run on a server. Randomly someone in HR will ask us to run one of these tasks for them out of schedule. To make this easier and more expedient for the HR folks, i'm ...
Kormath's user avatar
  • 11
0 votes
1 answer
1k views

Passwordless auth for WinRM

I need to connect to a list of windows servers and update certificates from a certificate host. The certificate host is running certbot on linux. All hosts are connected to the domain and the linux ...
user319862's user avatar
0 votes
1 answer
726 views

powershell core 7 get-counter command is not working

I have installed Powershell 7 core and trying to run get-counter but it says get-counter : The term 'get-counter' is not recognized as the name of a cmdlet, function, script file, or operable ...
karthick's user avatar
  • 327
0 votes
2 answers
996 views

'unlock-adaccount' is not recognized in Powershell on Server 2012 r2

I'm trying to use Unlock-ADAccount in a powershell script running on a Windows Server 2012 R2 box. This is what I get: PS C:\> unlock-adaccount unlock-adaccount : The term 'unlock-adaccount' is ...
Tim's user avatar
  • 145
0 votes
2 answers
225 views

How to run aws after installing awscli

Here are the code in powershell script I run to provision a Windows 2012 server on an ec2 instance: # Set up chocolately Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net....
Anthony Kong's user avatar
  • 3,418
0 votes
1 answer
487 views

How to automate the installation of .net framework 3.5 with terraform and powershell?

The operating system is Windows Server 2012. This dialog box pops when a process starts on the server. Is it possible to automate the installation of the feature?
Anthony Kong's user avatar
  • 3,418
0 votes
1 answer
5k views

Powershell send-mailmessage logs

I need to debug Send-MailMessage command. In linux, I can see the logs of sending mail, via tail -f. There is an option to see the logs of this command? I want to send mail to an external domain, it ...
Amir Damirov's user avatar
0 votes
2 answers
9k views

Get-HotFix not returning all installed KBs

I'm having trouble with the Get-HotFix command on a Windows Server 2012 not returning all installed KBs, compared to what Windows Update says is actually installed on the server when querying it. Get-...
Samy Kacimi's user avatar
2 votes
1 answer
13k views

Unable to add printer driver using Add-PrinterDriver on 2012 R2 Print Server

I'm trying to setup a Windows Server 2012 R2 host as a print server. I'm at the early stage of trying to add a printer to the system. I'm trying to keep this as PowerShell based as possible, but I've ...
Dusty Vargas's user avatar
1 vote
3 answers
738 views

Delete Local Administrator

Back story real quick: some reason some servers have 2 local admin account... no idea, I took over the job and cleaning everything up. I need to go through 600-ish (or more) servers to delete the ...
Pavle Stojanovic's user avatar
3 votes
2 answers
26k views

WinRM remoting server with local Adminnistrator account not working?

I have a server Windows 2012R2 in the domain. This server has no domain user access, only local admin user. I can RDC into this machine using admin account, but cannot have a PSSession, so Enter-...
Dilshad Abduwali's user avatar
1 vote
0 answers
279 views

Msft_Volume: multiple records for 'D:'

Im getting some strange results for Msft_Volume query Get-WmiObject -Query "SELECT * FROM Msft_Volume" -Namespace Root/Microsoft/Windows/Storage I see 'D' drive six times! I there any explanation ...
John's user avatar
  • 542
0 votes
1 answer
647 views

AD users disabled through GUI shown as enabled in Powershell

I tried to use Powershell to audit disabled AD user accounts but the results I get do not match what is shown in GUI through Active Directory Users and Computers. DC is Windows server 2012R2 and ...
Madoc Comadrin's user avatar
0 votes
2 answers
6k views

How to copy a file in PowerShell while it is in use?

I need to copy a log file from a remote windows 2012 server. The log file will be written to constantly by our application. I know how to copy a remote file using Copy-Item Cmdlet. But I get error ...
Dilshad Abduwali's user avatar
3 votes
2 answers
539 views

Is Microsoft moving away from WMI?

I've using Linux for years and recently I've joined new organisation who's entire infrastructure is based on Windows Server 2012R2. Ever since then, I've been learning PowerShell and I find it is very ...
Dilshad Abduwali's user avatar
1 vote
0 answers
761 views

WSMan Works, WinRM Running, PSSession Doesn't Resolve Anything Just Hangs

I have four devices on the same network on the same domain. Server1 Server2 Workstation1 Workstation2 All devices have PSRemoting enabled. Server1 can Enter-PSSession on Server 2. Server2 can Enter-...
Fishcakes's user avatar
2 votes
1 answer
207 views

Is it possible to set a scheduled tasks to run both directly before and directly after a windows update?

We're currently attempting to find a solution to better automate our Windows updates on our IIS machines. We have an infrastructure that is hit by thousands of transactions at all hours of the day; ...
nostalgk's user avatar
  • 165
3 votes
2 answers
2k views

LiteralPath not working on PowerShell 5.1 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 ...
JeanneD4RK's user avatar
0 votes
1 answer
49 views

Get-Command Changing Drive

I wrote a powershell script that includes a check for the invoke-sqlcmd cmdlet. Script runs fine under Windows Server 2016. On 2012 R2, the script fails with: Add-Content : Cannot use interface... ...
lightwing's user avatar
0 votes
1 answer
251 views

Get-DnsServerForwarder in WinSrv2012R2

Can anyone tell me why when I execute this Powershel cmdlet I can see a DNS forwarder that I inserted earlier (also using PS) but I can't see it on the DNS management console? PS C:\Users\...
reikidude's user avatar
1 vote
1 answer
5k views

How to get infromation about disk location (like in diskmgmt.msc) via Powershell?

could you please help me how to get disk location number which can be found via Disk Management (diskmgmt.msc) for future VMware SCSI Disk devices assosciation via PowerShell or any other native ...
MyKE's user avatar
  • 301
0 votes
1 answer
495 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 ...
Krank's user avatar
  • 1
2 votes
1 answer
20k 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?
Darktux's user avatar
  • 827
2 votes
1 answer
2k 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-...
Squirreljester's user avatar
2 votes
0 answers
4k 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) ...
TimB's user avatar
  • 193
1 vote
1 answer
947 views

Windows Network Load Balancing Duplicates UDP Packages?

Background I have two Windows Server 2012R2 VMs (each with one NIC) listening on port 514 for Syslog UDP messages, which process and then persist the messages to a database. I tried setting up ...
Micah Hunsberger's user avatar
2 votes
1 answer
3k views

Proper method for detecting Apache Tomcat installation via PowerShell?

What's the proper method for detecting whether an arbitrary version of Apache Tomcat is installed on a given Windows server, which we can assume to be Windows Server 2012 R2 or greater, using ...
HopelessN00b's user avatar
  • 53.9k
0 votes
0 answers
405 views

Powershell Get IIS6 SMTP server domain Alias'

I'm attempting to write a script that will provide me with some information about the Windows SMTP service. if I use $smtpserver=[adsi]"IIS://localhost/SMTPSVC/1" I can get a whole bunch of ...
Bilbo Bongo's user avatar
1 vote
2 answers
111 views

AD User stuck in a service

So I am stuck with a really off issue. THe issue occurs when I changed my domain user password. SInce I am a domain admin also, and the user is being used with many services during the last password ...
UmairAhmed711's user avatar

1
2 3 4 5