I have a script I run that collects data from computers across the US. I have 7 regions that I collect the data from. My issue is that I have to run a PowerShell script for each region. Since I am collecting info to reflect the PC Health status of each region, I must run all 7 regions at the same time. I run each script -asjob with a 4 hour timer.<\/p>\n
I have been running this script on an HP G8 Laptop with only 8GB of RAM and all 7 regions would run at the same time with no issues. I now have a Dell 5520 that came with 16 GB of RAM. When I run all 7 regions on the Dell, it runs out of RAM and crashes. I upgraded the RAM to 32 GB and it still uses all of the available RAM and crashes. When I first received the laptop, it was able to run all 7 regions with no issues. About a year ago, the laptop began using all of the RAM and crashing. I have wiped the laptop and reinstalled all of the software but get the same results. I have tried running this on other Dells and get the same results. I can still run all 7 regions on the HP laptops though.<\/p>\n
Any ideas as to what may be causing this? Is this a PowerShell issue or a Dell issue?<\/p>\n
Any assistance would be greatly appreciated.<\/p>","upvoteCount":6,"answerCount":8,"datePublished":"2025-04-21T15:42:58.801Z","author":{"@type":"Person","name":"itguy54","url":"https://community.spiceworks.com/u/itguy54"},"suggestedAnswer":[{"@type":"Answer","text":"
I have a script I run that collects data from computers across the US. I have 7 regions that I collect the data from. My issue is that I have to run a PowerShell script for each region. Since I am collecting info to reflect the PC Health status of each region, I must run all 7 regions at the same time. I run each script -asjob with a 4 hour timer.<\/p>\n
I have been running this script on an HP G8 Laptop with only 8GB of RAM and all 7 regions would run at the same time with no issues. I now have a Dell 5520 that came with 16 GB of RAM. When I run all 7 regions on the Dell, it runs out of RAM and crashes. I upgraded the RAM to 32 GB and it still uses all of the available RAM and crashes. When I first received the laptop, it was able to run all 7 regions with no issues. About a year ago, the laptop began using all of the RAM and crashing. I have wiped the laptop and reinstalled all of the software but get the same results. I have tried running this on other Dells and get the same results. I can still run all 7 regions on the HP laptops though.<\/p>\n
Any ideas as to what may be causing this? Is this a PowerShell issue or a Dell issue?<\/p>\n
Any assistance would be greatly appreciated.<\/p>","upvoteCount":6,"datePublished":"2025-04-21T15:42:58.871Z","url":"https://community.spiceworks.com/t/powershell-ram-usage/1198185/1","author":{"@type":"Person","name":"itguy54","url":"https://community.spiceworks.com/u/itguy54"}},{"@type":"Answer","text":"
Without seeing the script that’s a hard diagnosis. Same OS on both? What version of Powershell on each? etc.<\/p>","upvoteCount":3,"datePublished":"2025-04-21T15:51:46.634Z","url":"https://community.spiceworks.com/t/powershell-ram-usage/1198185/2","author":{"@type":"Person","name":"PatrickFarrell","url":"https://community.spiceworks.com/u/PatrickFarrell"}},{"@type":"Answer","text":"
I’d also look at the script logic.<\/p>\n
Check that it’s not leaving sessions open to remote computers - close them once you’ve queried for health status.<\/p>\n
Output to a file as often as possible (after each query) - at least if the script crashes, it will have the info up to that point. If you gather all the info before dumping to a file - you’ll wind up with nothing if it crashes.<\/p>","upvoteCount":2,"datePublished":"2025-04-21T16:05:03.400Z","url":"https://community.spiceworks.com/t/powershell-ram-usage/1198185/3","author":{"@type":"Person","name":"phildrew","url":"https://community.spiceworks.com/u/phildrew"}},{"@type":"Answer","text":"
I’d wonder why if this is run frequently you do it from a laptop at all, and not scheduled from a server.<\/p>\n
Or leave it running on the HP as a scheduled task.<\/p>\n
As others have said though, we would need something about the script to figure out why it’s using all the resources. If 8GB was enough before, why isn’t 32GB now, perhaps there is an OS issue, or your using a new PS version and the code works better on older PS, a mix of both or something else completely.<\/p>\n
What does event log tell you?<\/p>\n
What was your previous OS and your current one?<\/p>","upvoteCount":1,"datePublished":"2025-04-21T16:40:11.319Z","url":"https://community.spiceworks.com/t/powershell-ram-usage/1198185/4","author":{"@type":"Person","name":"Rod-IT","url":"https://community.spiceworks.com/u/Rod-IT"}},{"@type":"Answer","text":"
Got any “+=” operations in that script?<\/p>","upvoteCount":2,"datePublished":"2025-04-21T18:19:39.112Z","url":"https://community.spiceworks.com/t/powershell-ram-usage/1198185/5","author":{"@type":"Person","name":"semicolon","url":"https://community.spiceworks.com/u/semicolon"}},{"@type":"Answer","text":"
Fun note, As of Powershell 7.5 preview 4, there is an enormous improvement in handling of that in speed and memory usage.<\/p>","upvoteCount":0,"datePublished":"2025-04-21T20:38:57.467Z","url":"https://community.spiceworks.com/t/powershell-ram-usage/1198185/6","author":{"@type":"Person","name":"PatrickFarrell","url":"https://community.spiceworks.com/u/PatrickFarrell"}},{"@type":"Answer","text":"