Running a script in Intune to adjust VRAM failing

Matt Rosier 20 Reputation points
2023-11-14T16:57:44.5666667+00:00

Hello all, good day to you!

We have an issue with a script we are running on devices via Intune. In the last 10 devices, 2 succeed, but the rest fail. And because of the way the status page works, it doesn't give any further info. So what I am hoping is I can share the script below and see if anyone has any suggestions to modify it. It used to work across the board, but recently this has been mostly failing. All it does is sets the virtual memory to 8192 MB is all.......

$pagefileset = Get-WmiObject Win32_pagefilesetting

$pagefileset.InitialSize = 8192

$pagefileset.MaximumSize = 8192

$pagefileset.Put() | Out-Null

Any thoughts on why this isn't working anymore? Just to reiterate we run this script from Intune to all devices via an Azure security group we use when building out a new laptop. Thanks folks!

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Intune | Other
{count} votes

Accepted answer
  1. Crystal-MSFT 53,986 Reputation points Microsoft External Staff
    2023-11-15T01:38:24.27+00:00

    @Matt Rosier, Thanks for posting in Q&A. For your command, based on my testing, when I manually run one device, I get error "The property 'InitialSize' cannot be found on this object".

    User's image

    After researching, I find when Pagefile is automatically managed, we can’t modify the setting so we need to remove that box. change the Virtual memory, we need to uncheck "Automatically manage paging file size for all drives".

    User's image

    Here is the code to uncheck the setting:

    $pagefile = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges
    $pagefile.AutomaticManagedPagefile = $false
    $pagefile.put() | Out-Null
    

    After running the above code, I find the virtual memory can be set.

    User's image

    For your scenario, you can try the above suggestion to see if it can work. Hope the above information can help.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentationhttps://learn.microsoft.com/en-us/answers/support/preferences to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.