Author Archives: chaoliu12

Get-ADObject Filter vs LDAP Filter

Get-ADObject Filter Definition: <filter> ::= “{” <FilterComponentList> “}” <FilterComponentList> ::= <FilterComponent> | <FilterComponent> <JoinOperator> <FilterComponent> | <NotOperator> <FilterComponent> <FilterComponent> ::= <attr> <FilterOperator> <value> | “(” <FilterComponent> “)” <FilterOperator> ::= “-eq” | “-le” | “-ge” | “-ne” | “-lt” | “-gt”| … Continue reading

Posted in Active Directory, Powershell | Leave a comment

Install GUI in Windows 2012 R2 Core

If the regular way failed, then they this way Copy the the C:\Windows\WinSxS from other server with GUI and same updates to C:\WinSxS of Core server Then run the command with -source C:\WinSxS Install-WindowsFeature server-gui-infra,server-gui-shell -source c:\WinSxS

Posted in Windows | Leave a comment

Install Offline standalone CA for Domain

Install standalone CA Change validity period to longer, so it can issue a longer period certificates. certutil -getreg ca\ValidityPeriod certutil -getreg ca\ValidityPeriodUnits certutil -setreg ca\ValidityPeriod “Years” certutil -setreg ca\ValidityPeriodUnits “20” Make standalone CA to support AD.  Don’t joint the standalone … Continue reading

Posted in Windows | Leave a comment

Write a GUI in Powershell – Part 7

7. Finish every else in Powershell. This script will run the timer. Once the time is reached, it will run the command. # (C) Chao Liu #=========================================================================== # Add CSharp Class to PowerShell #=========================================================================== $path=$PSScriptRoot $code=Get-Content -Raw -Path (Join-Path $path … Continue reading

Posted in C#, Powershell, XAML | Leave a comment

Write a GUI in Powershell – Part 6

6a. This is the last C# class. This class will call function in Kernel.dll and PowrProf.dll to get power info. using System; using System.Diagnostics; using System.Runtime.InteropServices; namespace PowerManagerNS { //public Guid GUID_SLEEP_SUBGROUP = new Guid(“238C9FA8-0AAD-41ED-83F4-97BE242C8F20”); public static class PowerManager { … Continue reading

Posted in C#, Powershell, XAML | Leave a comment

Write a GUI in Powershell – Part 5

5a. Create an other C# class using System; using System.ComponentModel; using System.Globalization; using System.Windows.Data; using System.Management.Automation; public class MultiValueConverterWrap : IMultiValueConverter { public Func<object[], Type, object, CultureInfo, PSObject> ConvertPS; public Func<object, Type[], object, CultureInfo, PSObject> ConvertBackPS; public int debugLevel = … Continue reading

Posted in C#, Powershell, XAML | Leave a comment

Write a GUI in Powershell – Part 4

4a. Create converter in C# for data binding for the same reason, Powershell doesn’t support C# interface. using System; using System.ComponentModel; using System.Globalization; using System.Windows.Data; using System.Management.Automation; public class ConverterWrap : IValueConverter { public Func<object, Type, object, CultureInfo, PSObject> ConvertPS; … Continue reading

Posted in C#, Powershell, XAML | Leave a comment