Set-DellAutoOnForSelectDays.ps1
function Set-DellAutoOnForSelectDays { <# .Synopsis Configures the system's auto-on capabilities that control individual days .Description This CmdLet sets the Auto-on to select days and enables or disables the individual days to automatically power on the system on a pre fixed . If a BIOS password (Admin or System password) is set, supply it using the -Password parameter. .Example Set-DellAutoonForSelectDays -Sunday "Enable" -Monday "Disable" -password $Password .Example Set-DellAutoonForSelectDays -Tuesday "Enable" .Example Set-DellAutoOnForSelectDays -verbose #> [CmdletBinding()] param( [Alias("Sun")][System.String] $Sunday, [Alias("Mon")][System.String] $Monday, [Alias("Tue")][System.String] $Tuesday, [Alias("Wed")][System.String] $Wednesday, [Alias("Thu")][System.String] $Thursday, [Alias("Fri")][System.String] $Friday, [Alias("Sat")][System.String] $Saturday, [Alias("pw")][Parameter(Mandatory=$false)][System.String] $Password ) BEGIN { Write-Output "Set-DellAutoOnForSelectDays" } PROCESS { #the process block is called for each item in the pipeline and you can reference it via $_ #Write-Output "in process" $pathToPowerManagement = 'DellSmbios' + ':\' + 'PowerManagement' $isAdminPWSet = Get-Item -path DellSmbios:\Security\IsAdminPasswordSet $issystemPWSet = Get-Item -path DellSmbios:\Security\IsSystemPasswordSet if (($isAdminPWSet.CurrentValue -match 'True') -or ($issystemPWSet.CurrentValue -match 'True')) { if ([string]::IsNullOrEmpty($Password)){ Write-Warning "Specify the password using -password." return } } if ($Password){ Set-Item -path $pathToPowerManagement\AutoOn -value "SelectDays" -password $Password -ErrorVariable ev } else{ Set-Item -path $pathToPowerManagement\AutoOn -value "SelectDays" -ErrorVariable ev} if ($ev){ Write-Warning "$ev Error occured in $($ev.InvocationInfo.ScriptName)" return } if ($PSBoundParameters.ContainsKey('sunday')) { if ($password){ Set-Item -path DellSmbios:\PowerManagement\AutoOnSunday -value $Sunday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnSunday -value $Sunday -ErrorVariable ev} } if ($PSBoundParameters.ContainsKey('Monday')) { if ($password){ Set-Item -path $pathToPowerManagement\AutoOnMonday -value $Monday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnMonday -value $Monday -ErrorVariable ev} } if ($PSBoundParameters.ContainsKey('Tuesday')) { if ($password){ Set-Item -path $pathToPowerManagement\AutoOnTuesday -value $Tuesday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnTuesday -value $Tuesday -ErrorVariable ev} } if ($PSBoundParameters.ContainsKey('Wednesday')) { if ($password){ Set-Item -path $pathToPowerManagement\AutoOnWednesday -value $Wednesday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnWednesday -value $Wednesday -ErrorVariable ev} } if ($PSBoundParameters.ContainsKey('Thursday')) { if ($password){ Set-Item -path $pathToPowerManagement\AutoOnThursday -value $Thursday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnThursday -value $Thursday -ErrorVariable ev} } if ($PSBoundParameters.ContainsKey('Friday')) { if ($password){ Set-Item -path $pathToPowerManagement\AutoOnFriday -value $Friday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnFriday -value $Friday -ErrorVariable ev} } if ($PSBoundParameters.ContainsKey('Saturday')) { if ($password){ Set-Item -path $pathToPowerManagement\AutoOnSaturday -value $Saturday -password $Password -ErrorVariable ev } else {Set-Item -path DellSmbios:\PowerManagement\AutoOnSaturday -value $Saturday -ErrorVariable ev} } if ($ev){ Write-Warning "$ev Error occured in $($ev.InvocationInfo.ScriptName)" } } END{} } # SIG # Begin signature block # MIIZCAYJKoZIhvcNAQcCoIIY+TCCGPUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUVtVpDJmCpRoVmHb9THexSoYM # 9a+gghQAMIID7jCCA1egAwIBAgIQ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qYVHOXhenehm2G+5wawzoo+D5uNKhFVWh3ZyoRay # NpC3+lrVHDczWDYFoS+gcb666ursLTYBe5JkOtcQLOX/XhPJv4rfluJKKgewKMo8 # 99lK1f2xkhsXk815HPS9ccOJc3fOPr2ae86qH2unI9l3gkNS5nnIA10IBrribwJd # nKW93/esbMY0BEaUA52XrOsgYPd1KgqD+gqGxLhScriYCMZrXIQsXT/aeR1L4VbW # MH+V34MHZMefLXXcam9C2OcLMACL23QvlmT1VBfaMEDvGFifzsh8RYkhabY6JM34 # 2r3WPLpBBRh0LU4/6RTFhmAQ/GmR38xzsX/gMI+hggILMIICBwYJKoZIhvcNAQkG # MYIB+DCCAfQCAQEwcjBeMQswCQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMg # Q29ycG9yYXRpb24xMDAuBgNVBAMTJ1N5bWFudGVjIFRpbWUgU3RhbXBpbmcgU2Vy # dmljZXMgQ0EgLSBHMgIQDs/0OMj+vzVuBNhqmBsaUDAJBgUrDgMCGgUAoF0wGAYJ # KoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTUxMDIwMDcy # MTM3WjAjBgkqhkiG9w0BCQQxFgQUsz1ldZwsaqZs1xpwRMd7BhSjXxIwDQYJKoZI # hvcNAQEBBQAEggEANSxyjERKM2leo0c1ppWqSTopVr3xmxwrmaewPyVE++2Kqcop # Apq8eV8AxonC+ArRc+Z1eBgb7givR8V/EDUugkcabklPWBLTc5lBFYUAegoAXucJ # YbP4PZE4Aq+SKJKQNdKgJsao7sFFE26z0avYzrJOXm5Ga7l0ngNRLAvj7rungfDB # P9bsTQ55y9gUvW7ajWusuknUviMEA1NRIEPtEBMdUMJuaJMBktkIm1HUxIpNJO53 # vnU1h4Ciyqk4EiE771Vv1k7B7Ajxh/uMcHL8BY7hOo3XsH7ZWCu0Yob0uvTI+I7H # cEtMLNZX7dS9ZB9WZA7xBN915TSSNxV0iwNM/g== # SIG # End signature block |