Search Results for get-ciminstance

Windows SID to username and vice versa

investigate laptop with magnifying glass - Photo by Agence Olloweb (https://unsplash.com/@olloweb) on Unsplash (https://unsplash.com/photos/magnifying-glass-near-gray-laptop-computer-d9ILr-dbEdg)

...$objUser = New-Object System.Security.Principal.NTAccount("LOCAL_USER_NAME") $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]) $strSID.Value These use the System.Security.Principal.NTAccount class of .NET. Using Get-CimInstance / WMI, you can use: Get-CimInstance -ClassName Win32_UserAccount | ?{$_.Name -eq "USER_NAME"} | Select-Object SID...

Get Hyper-V guest serial number with PowerShell

PowerShell 5.0 logo

...VMs: Get-WmiObject -ComputerName hyper-v_host -Namespace root\virtualization\v2 -class Msvm_VirtualSystemSettingData | select elementname, BIOSSerialNumber Or use Get-CimInstance: Get-CimInstance -ComputerName hyper-v_host -Namespace root\virtualization\v2 -class Msvm_VirtualSystemSettingData | select elementname, BIOSSerialNumber The output is of...

Monitor website performance in IIS with Zabbix

Zabbix logo

...= (Get-CimInstance -EA SilentlyContinue -Query "select * from Win32_PerfRawData_W3SVC_WebService" -Namespace root\cimv2).Name # Get all Win32_PerfRawData_W3SVC_WebService properties for all websites $allwebsiteinfo = Get-CimInstance -EA SilentlyContinue -Query "select * from Win32_PerfRawData_W3SVC_WebService" -Namespace...

Emulate ternary operator in PowerShell

PowerShell 5.0 logo

...a Windows Server Desktop Experience version or not (and thus Server Core): $condition = (Get-CimInstance Win32_OptionalFeature | Where-Object Name -eq 'Server-Gui-Mgmt').InstallState ({true}, {false})[!$condition] This returns true for a GUI enabled...

Enable NTFS long paths through GPO in Windows Server

Enable Win32 long paths through GPO in Windows Server

...2016 build is 10.0.14393 [version]"10.0.14393" [version] $winver = $(Get-CimInstance -Namespace root\cimv2 -Query "SELECT Version FROM Win32_OperatingSystem").Version if($winver -ge [version]"10.0.14393") { if ($(Test-RegistryValue "HKLM:System\CurrentControlSet\Control\FileSystem" LongPathsEnabled) -eq $false) { New-ItemProperty -Path "HKLM:System\CurrentControlSet\Control\FileSystem"...