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…
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…
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…
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…
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…
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:…
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…
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…
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…
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…
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,…
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…
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) …
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…
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…
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 …
"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…
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? …
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…
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…