瀏覽代碼

add get-monitorsize

Tobias Simetsreiter 2 年之前
父節點
當前提交
729d9c6afb
共有 2 個文件被更改,包括 16 次插入10 次删除
  1. 8 0
      bin/Get-MonitorSize.ps1
  2. 8 10
      bin/Set-AutoLogin.ps1

+ 8 - 0
bin/Get-MonitorSize.ps1

@@ -0,0 +1,8 @@
+Add-Type -AssemblyName System.Windows.Forms
+# [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize
+$WmiVideoController=(Get-WmiObject -Class Win32_VideoController).VideoModeDescription;
+
+[PSCustomObject]@{
+    FormsScreens=[System.Windows.Forms.Screen]::AllScreens;
+    WmiVideoController=$WmiVideoController;
+}

+ 8 - 10
bin/Set-AutoLogin.ps1

@@ -1,7 +1,7 @@
 param(
     $Username = $null,
     $Pass = $null,
-    [Parameter(HelpMessage="Disables AutoLogin")]
+    [Parameter(HelpMessage = "Disables AutoLogin")]
     [switch]$Disable = $false
 )
 
@@ -24,7 +24,7 @@ if ($Disable) {
     exit
 }
 
-if ($null -eq $Username){
+if ($null -eq $Username) {
     $Username = Read-Host 'Enter username for auto-logon (f.e. contoso\user1)'
 }
 
@@ -32,19 +32,17 @@ if ("" -eq $Username) {
     throw "Username is Empty!"
 }
 
-if ($null -eq $Pass){
+if ($null -eq $Pass) {
     $Pass = Read-Host "Enter password for $Username"
 }
-Set-ItemProperty $RegistryPath 'AutoAdminLogon' -Value "1" -Type String 
-Set-ItemProperty $RegistryPath 'DefaultUsername' -Value "$Username" -type String 
+Set-ItemProperty $RegistryPath 'AutoAdminLogon' -Value "1" -Type String
+Set-ItemProperty $RegistryPath 'DefaultUsername' -Value "$Username" -type String
 Set-ItemProperty $RegistryPath 'DefaultPassword' -Value "$Pass" -type String
- 
+
 Write-Warning "Auto-Login for $username configured. Please restart computer."
- 
+
 $restart = Read-Host 'Do you want to restart your computer now for testing auto-logon? (Y/N)'
- 
+
 If ($restart -eq 'Y') {
- 
     Restart-Computer -Force
- 
 }