Home > front end >  Check GPU PowerShell
Check GPU PowerShell

Time:12-31

My PowerShell Script Optimizing Graphics Cards So When i call GPU Tweaker it gives this error the term "GpuTweaker" is not recognized as the name of a cmdlet function script file or operable program can some one edit my code ?

$GPU = (Get-WmiObject Win32_VideoController).Name
Function GPUTweaker{
    If ($GPU -like "*NVIDIA*") {
        <FunctionName>
    }

    If ($GPU -like "*AMD*") {
        <FunctionName>
    }

    If ($GPU -like "*Intel*") {
        <FunctionName>
    }
}

CodePudding user response:

For -like operator you should use wildcards, otherwise it'll not return desired result.

In my example:

C:\> $gpu = (Get-WmiObject Win32_VideoController).Name
C:\> $gpu 
Intel(R) UHD Graphics 620

C:\> $gpu -like "Intel"
False

C:\> $gpu -like "*Intel*"
True

C:\> $gpu -like "Intel*" 
True

See about_Comparison_Operators for more examples.

  • Related