5,381 questions with Windows Server PowerShell tags

Sort by: Updated
1 answer

checking all on-premise DCs for last logon of csv list of users

Hi all, I hope all is well wherever you may be I have been asked to check the last logon of around a thousand accounts, now listed in a csv. I can run Import-csv "d:\temp\path_to.csv" |foreach-object {get-aduser $_.samaccountname…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-29T21:40:49.863+00:00
somnio 1 Reputation point
commented 2020-08-05T01:50:36.03+00:00
1 answer One of the answers was accepted by the question author.

counting an array 10 at a time until complete

Hello, How do you loop through an array 10 at a time until complete? I would like to reboot quite a few servers in a cluster and have come up with the following but I am curious is there is a way get 10, then get the next 10 and the next 10, etc…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-08-03T20:55:27.81+00:00
wca4oi 21 Reputation points
accepted 2020-08-04T19:35:03.527+00:00
wca4oi 21 Reputation points
4 answers

Robocopy not deleting source files

Hi Experts, Could you please advice on the following. Thank you. 1) Robocopy is having issues deleting the source files after the move. Below is the error. (from Robocopy.log) ERROR 32 (0x00000020) Deleting Source Directory \server01\Folder1\ The…

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,171 questions
Windows Server Backup
Windows Server Backup
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Backup: A duplicate copy of a program, a disk, or data, made either for archiving purposes or for safeguarding valuable files from loss should the active copy be damaged or destroyed.
452 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-30T22:24:11.783+00:00
jayanthi ramprakash 46 Reputation points
commented 2020-08-03T21:46:23.823+00:00
Rich Matheisen 45,091 Reputation points
1 answer

PowerShell DSC - Unable To Access a Share using Script Resource

Hi, I am looking to set up a DSC Script to download some files from a network share and unzip them to a location on the remote node. I cannot get the script to work, I have granted the correct permissions to the share, the receiving node has Full Control…

Windows Server Management
Windows Server Management
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Management: The act or process of organizing, handling, directing or controlling something.
421 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-30T15:44:00.643+00:00
fja 1 Reputation point
answered 2020-08-03T08:05:44.243+00:00
1 answer

Invoke-RestMethod issue with plus symbol in URL

I have an API that I access from a linux server now but it is being decommissioned so I am converting my API calls to windows. I use this call in linux and it works fine: curl…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-30T22:05:57.073+00:00
Bill C 1 Reputation point
answered 2020-08-02T20:09:16.913+00:00
Rich Matheisen 45,091 Reputation points
1 answer

How can I find all sub-domains using PowerShell?

I can use Resolve-Dns to retrieve an A record (if one exists) for a given domain name. Is there a way, using PowerShell, to find all sub-domains? Here's a specific use case: One of Microsoft's stated domains to allow through firewalls is:…

Windows DHCP
Windows DHCP
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.DHCP: Dynamic Host Configuration Protocol (DHCP). A communications protocol that lets network administrators manage centrally and automate the assignment of Internet Protocol (IP) addresses in an organization's network.
1,023 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-31T11:45:58.277+00:00
Kevin D. Boutelle 21 Reputation points
answered 2020-07-31T19:52:09.493+00:00
Rich Matheisen 45,091 Reputation points
4 answers One of the answers was accepted by the question author.

Remove-ADComputer for remote server on a different domain

Hi I'm trying to delete the "testserver" AD object via PowerShell. This works if the "testserver" is on the same domain as my laptop where I'm running my script from (dmn1.contoso.local). However, if the "testserver" is on…

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,898 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-28T19:22:48.143+00:00
Ryan 21 Reputation points
accepted 2020-07-30T16:50:50.897+00:00
Ryan 21 Reputation points
2 answers

Cant set-location to NAS drive or get-childitem using powershell

Hi I have Netgear STORA attached to surfacePro4 using a USB to ethernet adapter. I can ping successfully to the location \stora using both powershell and command prompt. z: has been assigned to the required location on the stora I can use DIR to…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-21T06:25:56.32+00:00
Lucky de Silva 1 Reputation point
commented 2020-07-30T01:42:46.913+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
1 answer

Reading "exit code [0]" from a log file in powershell

When an installation is successful the last line in the log file shows "exit code [0]" . I want to read that line using my script and get the result. I am able to read just the string "exit code" but its not able to read…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-28T12:24:51.077+00:00
Durgesh007 1 Reputation point
answered 2020-07-28T15:14:36.327+00:00
Rich Matheisen 45,091 Reputation points
2 answers

Undo changes made in 'for developers'

Hi, In settings under 'For Developers' section, PowerShell and Remote Desktop have all options/items selected. Apply was clicked on both of those now no changes can be made (writing has gone grey). By clicking apply did I make changes to my computer or…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-21T11:30:46.883+00:00
Verona 1 Reputation point
commented 2020-07-28T02:03:41.027+00:00
2 answers

Powershell script does not execute when being run in a folder with special character, for example C:\Test'1. If I run the powershell command from there, there is no issue, but executing the ps1 does not work.

Powershell script does not execute when being run in a folder with special character, for example C:\Test'1. If I run the powershell command from there, there is no issue, but executing the ps1 does not work. I tried it with multiple type of script,…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-22T14:04:18.577+00:00
Guillaume Archambault 1 Reputation point
commented 2020-07-28T02:02:56.77+00:00
4 answers One of the answers was accepted by the question author.

New Registry Path with Long Name

Hi All I am trying to add a new registry key which contains a very long value. I can create the registry key : New-Item "HKLM:SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\Test1.com" I am trying to add…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-23T23:41:20.457+00:00
Toror72 21 Reputation points
answered 2020-07-28T00:28:26.667+00:00
Toror72 21 Reputation points
2 answers

match a value in an array

Hi, I've got this script that tells me if a value exits in groups.name now I want it to tell me when it doesn't exist. ForEach($asset in $currentFlexAssets.data.attributes.name) { ForEach($group in $groups.Name) …

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-27T12:59:58.377+00:00
Sebastiaan Castenmiller 1 Reputation point
answered 2020-07-27T19:26:26.437+00:00
Rich Matheisen 45,091 Reputation points
6 answers One of the answers was accepted by the question author.

Powershell - how to interrogate Windows Index file

On my W10 desktop I have about 3000 mp3 files in folders organised by Genre. I would like to mirror all the files which have a Rating of >3 to my NAS which runs a media server. I understand that because mp3 files are compressed it would not be…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-22T16:08:53.53+00:00
David Stokes 96 Reputation points
answered 2020-07-27T01:53:07.933+00:00
Rich Matheisen 45,091 Reputation points
3 answers

Bad_syst_config_info

Recently received stop code with error message bad system config info The screen started what seems to be called blue death screen loop with restarts . I managed to get to advanced options screen but I can’t get any further . For some reason there is…

Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,274 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-16T12:15:07.717+00:00
Shill 1 Reputation point
commented 2020-07-24T07:29:13.487+00:00
Cherry Zhang (Shanghai Wicresoft) 11 Reputation points
3 answers One of the answers was accepted by the question author.

syntax error

Hi All i am using the below query but still i am getting in output IT manager which i am not supposed to, experts guide me …

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-16T03:14:56.707+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
commented 2020-07-16T08:06:27.817+00:00
1 answer One of the answers was accepted by the question author.

"Deny this user permissions to log on to remote desktop session host server" - Powershell command

HI Guys, I'm looking for Powershell command to Enable/Disable the "Deny this user permissions to log on to remote desktop session host server" on user object. Not able to find the correct attribute. can anyone please help me with…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-16T03:00:33.537+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
accepted 2020-07-16T06:14:07.937+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

How to find out untrusted workstations?

I often see the following error “The trust relationship between this workstation and the primary domain failed” How can i find out these error workstations by powershell or other script? …

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-16T03:03:46.347+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
accepted 2020-07-16T06:12:55.417+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

New-Item fails on "Policies" hive with access denied

It seems I can't write under policies, but directy I can. I need to alter something in registery under Policies. Is this doable? New-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\System" -Force New-ItemProperty -Path…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-16T03:08:35.977+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
accepted 2020-07-16T06:12:48.69+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

Delete AD Group/Members

Hi All I have AD groups in csv file, i want to delete all the members of that groups. Will the below syntax help me. Below is my csv file(there is space between Group and 01) GroupName Group 01 Group 02 Group 03 $groups=import-csv…

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
asked 2020-07-16T03:17:28.263+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
accepted 2020-07-16T06:12:42.767+00:00
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor