dev247

powershell one-liners

Jun 10th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <##
  2. #
  3. #
  4. # MODULE OF:
  5. #
  6. #
  7. # ..One-Hundred-and-One one-liners of powershell..
  8. #
  9. # Author: Chris Dek.
  10. #
  11. # Usage: From the powershell cmdlet run the command:
  12. # Import-Module .\Hundred-OneLines.psm1
  13. # ..wait for a while to load.
  14. #
  15. # After loading, type each variable exported in the command shell to load the relevant data
  16. #
  17. # Example: PS C:> $diskinfo
  18. #
  19. # Note: Most of the exported cmds below
  20. # require admin priviledges (RUN THIS FILE AS ADMIN.)
  21. #
  22. #
  23. #
  24. #
  25. ##>
  26. function Extract-MetadataCmd {
  27. [CmdletBinding()]
  28. param($commandName,
  29. [Parameter(Mandatory=$true,Position=1)]
  30. $outputFile =$(Throw "Please define the output path for the proxy function body!")
  31. )
  32. $proxyfuncbody = [Management.Automation.ProxyCommand]::Create((New-Object Management.Automation.CommandMetaData(Get-Command $($commandName))))
  33. Set-Content -Path $outputFile -Value $proxyfuncbody
  34. }
  35.  
  36. #Retrieve VSS for current disk
  37. $vssout = Get-CimInstance -ClassName Win32_shadowCopy | Select { $_.InstallDate,$_.ID }
  38. #Retrieve CPU architecture
  39. $is64bit = (Get-WmiObject -Class Win32_ComputerSystem).SystemType -match "(x64)"
  40. #Retrieve bios info, verify virtualization VT-d on BIOS
  41. $biosout =  Get-WmiObject -ComputerName $env:COMPUTERNAME -Class Win32_BIOS
  42. $vtdbiosOK = Get-WmiObject -Class Win32_Processor |  Select VirtualizationFirmwareEnabled
  43. #Verify remote desktop enabled/disabled
  44. #Remote desktop checker-regvals
  45. $isRDPoff = $((Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server').fDenyTSConnections -eq 1)
  46. $isRDPon = $((Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-tcp').UserAuthentication -eq 1)
  47. ###$isRDPoff = $((Get-CimInstance Win32_TSGeneralSetting -Namespace \root\cimv2\TerminalServices).AllowTSConnections -eq 1)
  48. #General OS info
  49. $osout = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $env:COMPUTERNAME | Select Caption, BuildNumber, Description, ServicePackMajorVersion, ServicePackMinorVersion
  50. #General User account info (local accounts)
  51. $accout = Get-WmiObject -Class Win32_UserAccount -Filter  "LocalAccount='True'"
  52. $userlogon = Get-WmiObject -Class Win32_LoggedOnUser -ComputerName $env:COMPUTERNAME | Select {$_}
  53. #usb driver and other PC hardware information
  54. $usbdrives = Get-WmiObject -Class Win32_PnPEntity | Where {$_.DeviceID -like "*USB*" } | Select DeviceID, ErrorDescription, Status
  55. $physMedia = Get-WmiObject -Class Win32_PhysicalMedia | Select Manufacturer, Tag, Status, Removable, WriteProtectOn
  56. #network adapter information
  57. $adaptinfo = Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Select IPAddress, MacAddress, IPSubnet
  58. #Verify that network address rand. is enabled
  59. $adaptrndOn = $((Get-ItemProperty -Path 'HKLM:\Software\Microsoft\WlanSvc\Interfaces\{2CA63505-D7C7-40CB-A511-02DC9A38F2DD}').RandomMacState[0].toString() -eq 1)
  60. #disk/partition information
  61. $diskinfo = Get-CimInstance -ClassName Win32_LogicalDisk | Select DeviceID, FileSystem, FreeSpace
  62. $partinfo = Get-CimInstance -ClassName Win32_LogicalDisk | Select VolumeName, VolumeSerialNumber, Status, StatusInfo
  63. #Get eventlog files avail. and statuses
  64. $eventinfo = Get-WmiObject -Class Win32_NTEventlogFile | Select -Unique CreationDate, CSName, Description, LogFileName, Readable, Writeable
  65. #Currently logged on user info
  66. $currprofileinfo = Get-CimInstance -ClassName Win32_NetworkLoginProfile -Namespace "root\cimv2" | Select {$_}
  67. $profilesconn = Get-WmiObject -Class Win32_NetworkLoginProfile | Select Name, AccountExpires, AuthorizationFlags, HomeDirectory, LastLogon, LastLogoff
  68. #Windows features, programs not installed/disabled
  69. $featuresDis = Get-WindowsOptionalFeature -Online | Select $_.FeatureName | Where { $_.State -eq "Disabled" }  | Format-Table -AutoSize
  70. $IISExists = (Test-Path $env:SystemDrive\inetpub\wwwroot) -and ((Get-ChildItem -Path "$env:windir\system32\inetsrv\*\*.dll").Length -gt 0) -and (Test-Path $env:windir\System32\inetsrv)
  71. ##Check by reg. val for installed IIS. This does not run if not installed.
  72. #$IISExistsReg = (Get-ItemProperty HKLM:\Software\Microsoft\INetStp -Name "PathWWWRoot" -eq "$env:SystemDrive\inetpub\wwwroot") -and (Get-ItemProperty "HKLM:\Software\Microsoft\INetStp" -Name "InstallPath" -eq "$env:windir\system32\inetsrv")
  73. $IISRunsOK = (Get-WmiObject -Class Win32_Service -ComputerName $env:COMPUTERNAME -Filter "Name='IISADMIN'").State -eq "Running"
  74. #Checks for default .net framework directories and other installation files (sql srv '14 and for VS (X64) '15)
  75. $dotNExists = (Test-Path $env:windir\Microsoft.NET\Framework\) -or (Test-Path $env:windir\Microsoft.NET\Framework64\) -and ((Get-ChildItem -Path $env:windir\Microsoft.NET\Framework64\ -Recurse).Length -ge 1070) -or ((Get-ChildItem -Path $env:windir\Microsoft.NET\Framework64\ -Recurse).Length -ge 1100) -and ((Get-ChildItem -Path $env:windir\Microsoft.NET\assembly\ | Where {$_.Name -like "GAC*" } ).Length -eq 3)
  76. $SqlInstalledOK = (Test-Path "$env:ProgramFiles\Microsoft SQL Server\MSSQL12.SQLEXPRESS") -or (Test-Path "${env:ProgramFiles(x86)}\Microsoft SQL Server\MSSQL12.SQLEXPRESS") -and ( ((Get-ChildItem "$env:ProgramFiles\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Binn\*.dll").Length -gt 10) -or ((Get-ChildItem "${env:ProgramFiles(x86)}\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Binn\*.dll").Length -gt 10) ) -and ((Get-ItemProperty -Path "HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL").SQLEXPRESS -like "*SQLEXPRESS*")
  77. $SqlAgentRunsOK = (Get-Service -Name 'SQLAgent$SQLEXPRESS').Status -eq "Stopped"
  78. $SqlExpressRunsOK = (Get-Service -Name 'MSSQL$SQLEXPRESS').Status -eq "Stopped"
  79. $VSInstalledOK = (Test-Path "$env:ProgramFiles\Microsoft Visual Studio 14.0\Common7") -or (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7") -and ($env:VS140COMNTOOLS -ne "" -or  $env:VS120COMNTOOLS -ne "" -or $env:VS110COMNTOOLS -ne "") -and (Test-Path $env:VS140COMNTOOLS\1033) -and ((Get-ChildItem -Path $env:VS140COMNTOOLS -Recurse).Length -gt 10) -and ( ((Get-ChildItem -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\InstalledProducts").Name -like "*Microsoft*").Length -ge 5 ) -and ( ((Get-ChildItem -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\InstalledProducts").Name -like "*ASP*").Length -ge 2 ) -and  ((Get-ItemPropertyValue -Path "HKLM:\Software\WOW6432Node\Microsoft\VisualStudio\14.0" -Name  "InstallDir").Length -ge 1)
  80. $VCPPRedistOK = ((Test-Path -PathType Leaf $env:windir\system32\msvcr110.dll) -or (Test-Path -PathType Leaf $env:windir\system32\msvcr100.dll) -or (Test-Path -PathType Leaf $env:windir\system32\msvcr120.dll)) -and ((Get-ItemPropertyValue -Path "HKLM:\Software\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F" -Name "Version" -ErrorAction SilentlyContinue) -like "1678*") -or ((Get-ItemPropertyValue -Path "HKLM:\Software\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}" -Name "Version" -ErrorAction SilentlyContinue) -like "11.0*") -or ((Get-ItemPropertyValue -Path "HKLM:\Software\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f}" -Name "Version" -ErrorAction SilentlyContinue) -like "12.0*") -or ((Get-ItemPropertyValue -Path "HKLM:\Software\Classes\Installer\Dependencies\{d992c12e-cab2-426f-bde3-fb8c53950b0d}" -Name "Version" -ErrorAction SilentlyContinue) -like "14.0*")
  81. #This section checks for Git,Mercurial vcontrol installations.
  82. $VerCInstalledOK = ((Test-Path -PathType Leaf $env:ProgramFiles\TortoiseHg\*.exe) -or (Test-Path -PathType Leaf $env:ProgramFiles\Git\bin\*.exe) -or (Test-Path -PathType Leaf ${env:ProgramFiles(x86)}\Git\bin\*.exe) -or (Test-Path $env:ProgramData\Git\config) -or (Test-Path $env:ProgramFiles\TortoiseHg) -or (Test-Path ${env:ProgramFiles(x86)}\TortoiseHg)) -and (Test-Path -PathType Leaf $env:USERPROFILE\.gitconfig) -and (Test-Path -PathType Leaf $env:ProgramFiles\Git\mingw64\etc\gitconfig) -and (($env:Path -match 'git') -or ($env:Path -match 'Hg') -or ($env:Path -match 'Tortoise')) -and (Test-Path -PathType Leaf $env:USERPROFILE\mercurial.ini)
  83. $FoldersUnderGitVControl = Get-ChildItem -Path $env:SystemDrive -Recurse | Where {($_ -like "*.gitattributes") -or ($_ -like "*.gitignore")}
  84. $FoldersUnderMercurialVControl = Get-ChildItem $env:SystemDrive\*\*\*\.hg -Recurse | Where {($_ -match 'requires') -or ($_ -match 'branch') -or ($_ -match 'hgrc') -or ($_ -match '00changelog')}
  85. $VStudioVersionsInstalled = (Get-Item "HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\").GetSubKeyNames()
  86. $VStudioAppIDsInstalled = Get-ChildItem -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\" | Select {$_.GetValue("SecurityAppID")}
  87. $VStudioRelevantInstalls = Get-WmiObject -Class Win32_Product -Computer . | Where {$_.Name -like "*Visual Studio*" } | Format-Table -AutoSize
  88. #Network firewalls, vpns etc..
  89. $allNetInfo = Get-WmiObject Win32_NetworkAdapterConfiguration -ErrorAction 'Stop' | Select-Object -Property @{L='DeviceID'; E={$_.Index}}, DNSDomain, PhysicalAdapter, Manufacturer, Description, IPEnabled | Format-Table -ShowError
  90. $isLocalActive = Test-Connection -ComputerName $env:COMPUTERNAME -Quiet
  91. $isFirewallactive = ((netsh advfirewall show domain state)[3] -match "ON")
  92. $ipAddressExtn = (Invoke-WebRequest -Uri "http://checkip.dyndns.com").Content -replace "[a-z]|[A-Z]","" -replace "(<>)|(</>)|(:)",""
  93. #Mobile Dev. Management information
  94. $webAppinfo = Get-CimInstance -Namespace "Root\cimv2\mdm" -ClassName "MDM_WebApplication"
  95. $wifiProfileinfo = (netsh wlan show all)[141..156]
  96. $wifiProfilesByName = (netsh wlan show all)[159..287]
  97. #HDD and other drive relevant information..
  98. $volIDinfo = Get-WmiObject Win32_Volume -filter "drivetype=3" | Select DeviceID
  99. $hddinfo = Get-WmiObject Win32_DiskDrive | Select DeviceID,Signature,Model
  100. $partitioninfo = Get-WmiObject -Class Win32_DiskPartition | Select Index, Availability, Access, BlockSize, HiddenSectors, Size | Format-Table -AutoSize
  101. $pshelldrvinfo = Get-PSDrive
  102. #Ports Information, connections etc..
  103. $sslportsopen = netstat -na  | findstr :443 | Where {$_ -match "ESTABLISHED" -or $_ -match "LISTENING"}
  104. $winrmportsopen = netstat -na | findstr :5985 | Where {$_ -match "ESTABLISHED" -or $_ -match "LISTENING"}
  105. #Sql relevant information SQL SERVER 2014 (NOTE: The SQL service must be running locally with WinRM Svc enabled to use Wmi classes and SQLPS module installed/enabled for the query commands)
  106. #Default database used here is 'master', change accordingly.
  107. $sqlInstances = (Get-CimInstance -ComputerName $env:COMPUTERNAME -Namespace "root\Microsoft\SqlServer\ComputerManagement12" -ClassName ServerSettings).InstanceName
  108. $ChecksqlCmdOK = Invoke-Sqlcmd -Query "Print 'Query OK'" -ServerInstance ".\$sqlInstances" -Verbose
  109. $sqlDatabases = Invoke-Sqlcmd -Query "select @@servername as InstanceName,name as DatabaseName from sys.databases" -ServerInstance ".\$sqlInstances"
  110. $sqlTables = Invoke-Sqlcmd -Query "select name from sys.tables" -ServerInstance ".\$sqlInstances" -Database "master"
  111. $sqlSProcedures = Invoke-Sqlcmd -Query "Select * from sys.procedures" -ServerInstance ".\$sqlInstances" -Database "master" | Format-Table -AutoSize
  112. $sqlBaseParams = Invoke-Sqlcmd -Query "Select object_id, name, parameter_id, system_type_id, user_type_id, max_length, precision, is_nullable from sys.all_parameters" -ServerInstance ".\$sqlInstances" -Database "master" | Format-Table -AutoSize
  113. $sqlSrvVersion = Invoke-Sqlcmd -Query "select @@version" -ServerInstance ".\$sqlInstances" -QueryTimeout 3
  114. $sqlPKeys = Invoke-Sqlcmd -Query "select * from sys.key_constraints" -ServerInstance ".\$sqlInstances" -Database "master"
  115. $sqlFKeys = Invoke-Sqlcmd -Query "select * from sys.foreign_key_columns" -ServerInstance ".\$sqlInstances" -Database "master"
  116. #ASP .NET/core information..
  117. $alldotnetversions = Get-WmiObject Win32_Product | Where {$_.Name -like "*.NET*"} | Format-Table -AutoSize
  118. $allaspversions =  Get-WmiObject Win32_Product | Where {$_.Name -match "ASP\.NET"}
  119. $aspcoreversioninfo = Get-ChildItem -Path "HKLM:\Software\WoW6432Node\Microsoft\Updates\.NET Core" -ErrorAction SilentlyContinue
  120. $aspcoreinstalledOK = ((Get-Item -Path "HKLM:\Software\WoW6432Node\Microsoft\Updates\.NET Core" -ErrorAction Stop).GetSubKeyNames().Count -ge 1) -and ((Get-ChildItem -Path "HKLM:\Software\WoW6432Node\Microsoft\Updates\.NET Core" -ErrorAction Stop)[0].GetValue("ThisVersionInstalled") -eq "Y")
  121. #For these stats you need to enable WinRM service
  122. $aspperfstats1 = Get-CimInstance -Class Win32_PerfFormattedData_ASPNET_ASPNET -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  123. $aspperfstats2 = Get-CimInstance -Class Win32_PerfFormattedData_aspnetstate_ASPNETStateService -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  124. $aspperfstats3 = Get-CimInstance -Class Win32_PerfRawData_aspnetstate_ASPNETStateService -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  125. $aspperfstats4 = Get-CimInstance -Class Win32_PerfRawData_ASPNET_ASPNETApplications -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  126. $allaspnetwmiproviders = gwmi  -List "*ASPNET*" | Format-Table Name -AutoSize
  127. #Powershell information..
  128. $psversionfullstring = "Current PS Version is {0}.{1}.{2}.{3} - Edition Mode: {4}" -f $PSVersionTable.PSVersion.Major,$PSVersionTable.PSVersion.Minor,$PSVersionTable.PSVersion.Build,$PSVersionTable.PSVersion.Revision,$PSVersionTable.PSEdition
  129. $pshoststring = "Current PS Host is {0}, of Instance {1} LANG: {2}" -f $Host.Version, $Host.InstanceId, $Host.CurrentCulture
  130. $pslangcultureOK = ($Host.CurrentCulture -eq $Host.CurrentUICulture)
  131. $psrunspaceOK = $Host.IsRunspacePushed
  132. $psdbgOK = $Host.DebuggerEnabled
  133. $psscriptblocklogOK = (Test-Path -Path "HKLM:\SOFTWARE\WoW6432Node\Policies\Microsoft\PowerShell\ScriptBlockLogging") -or (Test-Path -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging") -or (Test-Path -Path "HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging")
  134. #HDD limit info..
  135. $freespacepercent = gwmi Win32_LogicalDisk -Filter "DeviceID='C:'" | Select Name, FileSystem,FreeSpace,BlockSize,Size | % {$_.BlockSize=(($_.FreeSpace)/($_.Size))*100;$_.FreeSpace=($_.FreeSpace/1GB);$_.Size=($_.Size/1GB);$_}| Format-Table Name, @{n='FS';e={$_.FileSystem}},@{n='Free, Gb';e={'{0:N2}'-f $_.FreeSpace}}, @{n='Free,%';e={'{0:N2}'-f $_.BlockSize}} -AutoSize
  136. $diskutillessthan30percent = (Get-WmiObject -Class Win32_LogicalDisk -ComputerName $env:COMPUTERNAME | Select { ( ([Math]::Round(($_.Size)/1GB) - [Math]::Round(($_.FreeSpace)/1GB)) /100 ) -ge 30.0})
  137. $isquotaOff = (Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName $env:COMPUTERNAME -Namespace "root\cimv2").QuotasDisabled
  138. $isquotaSupported = (Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName $env:COMPUTERNAME -Namespace "root\cimv2").SupportsDiskQuotas
  139. $getmappeddiskinfo = Get-WmiObject -Class Win32_LogicalDisk -ComputerName $env:COMPUTERNAME | Where { $_.DriveType -eq 4 }
  140. #Applications and settings..
  141. $allMSInstallations = Get-ItemProperty -Path "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | Select DisplayName, Publisher, CacheLocation | Where {$_.Publisher -like "Microsoft*"} | Format-Table -AutoSize
  142. $allGoogleInstallations = Get-ItemProperty -Path "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | Select DisplayName, Publisher, CacheLocation | Where {$_.Publisher -like "Google*" } | Format-Table -AutoSize
  143. $allAdobeInstallations = Get-ItemProperty -Path "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | Select DisplayName, Publisher, CacheLocation | Where {$_.Publisher -like "Adobe*" } | Format-Table -AutoSize
  144. $allMetroAppInstalls = Get-AppxPackage | Format-Table -AutoSize
  145. $allprinters = Get-CimInstance -ClassName Win32_PrinterConfiguration -ComputerName $env:COMPUTERNAME | Select Name, SettingID, Duplex, PaperSize
  146. $allsoundcards = Get-CimInstance -ClassName Win32_SoundDevice -ComputerName $env:COMPUTERNAME | Select ProductName, Status, StatusInfo, SystemName
  147. $allmonitors = Get-CimInstance -ClassName WIn32_DesktopMonitor -ComputerName $env:COMPUTERNAME
  148. $allkeyboardlayoutfriendlynames = (Get-ChildItem -Path "HKLM:\SYSTEM\ControlSet001\Control\Keyboard Layouts") | %{ $_.GetValue("Layout Text") }
  149. $allkeyboardlayouthexcodes = (Get-ChildItem -Path "HKLM:\SYSTEM\ControlSet001\Control\Keyboard Layouts").Name -replace "HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\Keyboard Layouts\\",""
  150. $allInstalledkeyboardlayouts = Get-ItemProperty -Path "HKCU:\Keyboard Layout\Preload"
  151. $isdefaultlayoutENUS = ((Get-ItemProperty -Path "HKCU:\Keyboard Layout\Preload").1 -eq "00000409")
  152. $isdefaultlayoutGR = ((Get-ItemProperty -Path "HKCU:\Keyboard Layout\Preload").1 -eq "00000408")
  153. $isdefaultlayoutFR = ((Get-ItemProperty -Path "HKCU:\Keyboard Layout\Preload").1 -eq "0000040c")
  154. $isdefaultInstalledlayoutENUS = ((Get-WmiObject -Class Win32_Keyboard -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").Layout -eq "00000409")
  155. #Other Hardware info..
  156. $cpuinfo = Get-CimInstance -ClassName Win32_Processor -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  157. $moboinfo = Get-CimInstance -ClassName Win32_MotherBoardDevice -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  158. $memoryinfo = Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2"
  159. $isRamSamsung = ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").PartNumber -like "M*B*-*") -or ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").PartNumber -like "M*T*-*")
  160. $isRamHynix = ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").PartNumber -like "HM*-*") -or  ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").PartNumber -like "HY*-*")
  161. $isRamKingston = ( ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").PartNumber -like "KHX*/*") -or ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2").PartNumber -like "KVR*/*") )
  162. $ramCount = Get-CimInstance -Class Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME -Namespace "root\CIMV2" | Select Name | Measure-Object -Property Name -Sum -ErrorAction SilentlyContinue | Select Count -ErrorAction SilentlyContinue
  163. $islaptop = ( ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME).ConfiguredVoltage /1000 -ge 1.2) -or ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME).ConfiguredVoltage /1000 -le 1.6) ) -or ((Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $env:COMPUTERNAME).ConfiguredVoltage /1000 -ne 2.6) -and ( (Get-CimInstance -ClassName Win32_Battery -ComputerName $env:COMPUTERNAME).DesignVoltage /1000 -le 14)
  164. #OS Recovery Information..
  165. $recovPartitioninfo = (Get-CimInstance -ClassName Win32_OSRecoveryConfiguration -ComputerName $env:COMPUTERNAME).Name | Select {$_ -replace "\\",""}
  166. $autoRebootEnabled = (Get-CimInstance -ClassName Win32_OSRecoveryConfiguration -ComputerName $env:COMPUTERNAME).AutoReboot
  167. #Additional OS File System sizing Information..
  168. $programfilesdirsize = "{0:N3} Gigabytes" -f ((Get-ChildItem -Path $env:ProgramFiles -Recurse -Filter * | Measure-Object -Sum -Property Length).Sum / 1GB)
  169. $downloadsdirsize = "{0:N3} Gigabytes" -f ((Get-ChildItem -Path "$env:USERPROFILE\Downloads" -Recurse -Filter * | Measure-Object -Sum -Property Length).Sum / 1GB)
  170.  
  171. ##
  172. #
  173. #Variables and Functions exported here...
  174. #
  175. ##
  176. Export-ModuleMember -Function 'Extract-MetadataCmd'
  177. Export-ModuleMember -Variable 'vssout'
  178. Export-ModuleMember -Variable 'is64bit'
  179. Export-ModuleMember -Variable 'biosout'
  180. Export-ModuleMember -Variable 'vtdbiosOK'
  181. Export-ModuleMember -Variable 'isRDPoff'
  182. Export-ModuleMember -Variable 'isRDPon'
  183. Export-ModuleMember -Variable 'osout'
  184. Export-ModuleMember -Variable 'accout'
  185. Export-ModuleMember -Variable 'userlogon'
  186. Export-ModuleMember -Variable 'usbdrives'
  187. Export-ModuleMember -Variable 'physMedia'
  188. Export-ModuleMember -Variable 'adaptinfo'
  189. Export-ModuleMember -Variable 'adaptrndOn'
  190. Export-ModuleMember -Variable 'diskinfo'
  191. Export-ModuleMember -Variable 'partinfo'
  192. Export-ModuleMember -Variable 'eventinfo'
  193. Export-ModuleMember -Variable 'currprofileinfo'
  194. Export-ModuleMember -Variable 'profilesconn'
  195. Export-ModuleMember -Variable 'featuresDis'
  196. Export-ModuleMember -Variable 'IISExists'
  197. Export-ModuleMember -Variable 'IISRunsOK'
  198. Export-ModuleMember -Variable 'dotNExists'
  199. Export-ModuleMember -Variable 'SqlInstalledOK'
  200. Export-ModuleMember -Variable 'SqlAgentRunsOK'
  201. Export-ModuleMember -Variable 'SqlExpressRunsOK'
  202. Export-ModuleMember -Variable 'VSInstalledOK'
  203. Export-ModuleMember -Variable 'VCPPRedistOK'
  204. Export-ModuleMember -Variable 'VerCInstalledOK'
  205. Export-ModuleMember -Variable 'FoldersUnderGitVControl'
  206. Export-ModuleMember -Variable 'FoldersUnderMercurialVControl'
  207. Export-ModuleMember -Variable 'VStudioVersionsInstalled'
  208. Export-ModuleMember -Variable 'VStudioAppIDsInstalled'
  209. Export-ModuleMember -Variable 'VStudioRelevantInstalls'
  210. Export-ModuleMember -Variable 'allNetInfo'
  211. Export-ModuleMember -Variable 'isLocalActive'
  212. Export-ModuleMember -Variable 'isFirewallactive'
  213. Export-ModuleMember -Variable 'ipAddressExtn'
  214. Export-ModuleMember -Variable 'webAppinfo'
  215. Export-ModuleMember -Variable 'wifiProfileinfo'
  216. Export-ModuleMember -Variable 'wifiProfilesByName'
  217. Export-ModuleMember -Variable 'volIDinfo'
  218. Export-ModuleMember -Variable 'hddinfo'
  219. Export-ModuleMember -Variable 'partitioninfo'
  220. Export-ModuleMember -Variable 'pshelldrvinfo'
  221. Export-ModuleMember -Variable 'sslportsopen'
  222. Export-ModuleMember -Variable 'winrmportsopen'
  223. Export-ModuleMember -Variable 'sqlInstances'
  224. Export-ModuleMember -Variable 'ChecksqlCmdOK'
  225. Export-ModuleMember -Variable 'sqlDatabases'
  226. Export-ModuleMember -Variable 'sqlTables'
  227. Export-ModuleMember -Variable 'sqlSProcedures'
  228. Export-ModuleMember -Variable 'sqlBaseParams'
  229. Export-ModuleMember -Variable 'sqlSrvVersion'
  230. Export-ModuleMember -Variable 'sqlPKeys'
  231. Export-ModuleMember -Variable 'sqlFKeys'
  232. Export-ModuleMember -Variable 'alldotnetversions'
  233. Export-ModuleMember -Variable 'allaspversions'
  234. Export-ModuleMember -Variable 'aspcoreversioninfo'
  235. Export-ModuleMember -Variable 'aspcoreinstalledOK'
  236. Export-ModuleMember -Variable 'aspperfstats1'
  237. Export-ModuleMember -Variable 'aspperfstats2'
  238. Export-ModuleMember -Variable 'aspperfstats3'
  239. Export-ModuleMember -Variable 'aspperfstats4'
  240. Export-ModuleMember -Variable 'allaspnetwmiproviders'
  241. Export-ModuleMember -Variable 'psversionfullstring'
  242. Export-ModuleMember -Variable 'pshoststring'
  243. Export-ModuleMember -Variable 'pslangcultureOK'
  244. Export-ModuleMember -Variable 'psrunspaceOK'
  245. Export-ModuleMember -Variable 'psdbgOK'
  246. Export-ModuleMember -Variable 'psscriptblocklogOK'
  247. Export-ModuleMember -Variable 'freespacepercent'
  248. Export-ModuleMember -Variable 'diskutillessthan30percent'
  249. Export-ModuleMember -Variable 'isquotaOff'
  250. Export-ModuleMember -Variable 'isquotaSupported'
  251. Export-ModuleMember -Variable 'getmappeddiskinfo'
  252. Export-ModuleMember -Variable 'allMSInstallations'
  253. Export-ModuleMember -Variable 'allGoogleInstallations'
  254. Export-ModuleMember -Variable 'allAdobeInstallations'
  255. Export-ModuleMember -Variable 'allMetroAppInstalls'
  256. Export-ModuleMember -Variable 'allprinters'
  257. Export-ModuleMember -Variable 'allsoundcards'
  258. Export-ModuleMember -Variable 'allmonitors'
  259. Export-ModuleMember -Variable 'allkeyboardlayoutfriendlynames'
  260. Export-ModuleMember -Variable 'allInstalledkeyboardlayouts'
  261. Export-ModuleMember -Variable 'allkeyboardlayouthexcodes'
  262. Export-ModuleMember -Variable 'isdefaultlayoutENUS'
  263. Export-ModuleMember -Variable 'isdefaultlayoutGR'
  264. Export-ModuleMember -Variable 'isdefaultlayoutFR'
  265. Export-ModuleMember -Variable 'isdefaultInstalledlayoutENUS'
  266. Export-ModuleMember -Variable 'cpuinfo'
  267. Export-ModuleMember -Variable 'moboinfo'
  268. Export-ModuleMember -Variable 'memoryinfo'
  269. Export-ModuleMember -Variable 'isRamSamsung'
  270. Export-ModuleMember -Variable 'isRamHynix'
  271. Export-ModuleMember -Variable 'ramCount'
  272. Export-ModuleMember -Variable 'isRamKingston'
  273. Export-ModuleMember -Variable 'islaptop'
  274. Export-ModuleMember -Variable 'recovPartitioninfo'
  275. Export-ModuleMember -Variable 'autoRebootEnabled'
  276. Export-ModuleMember -Variable 'programfilesdirsize'
  277. Export-ModuleMember -Variable 'downloadsdirsize'
Add Comment
Please, Sign In to add comment