Monday, 11 July 2016
Thursday, 7 July 2016
The following script, which needs to be run as administrator, adds a user to the administrators group using Powershell:
Replace `<domain>` with the domain and `<username>` with the username.
The following script will add the user to the administrators group, if they are not already a member, and then logoff:
To run this script as a desktop shortcut, we set the target to:
It will automatically resolve the `powershell.exe` to the full path of the Powershell executable.
Lastly, we can set the icon of the shortcut to an icon found in:
- ServerFault - Adding a user to the local Administrator group using powershell
- Ehlo World - Creating Desktop Shortcuts to Run PowerShell Scripts
- MSDN Forum - logoff command discusses the use of the `logoff` command
Friday, 1 July 2016
Thursday, 30 June 2016
Use Control-Alt-Enter to:
- move all browsers to the same page
- move all browsers to the same scroll position if they are on the same page
Wednesday, 22 June 2016
This simple example uses log4net version 2.0.3 to write to a `MemoryAppender` which is the read to produce a string at the end of all the log messages.
We first download and install log4net version 2.0.3 using NuGet Package Manager Console:
Configuring Log4net via config file
We place the following configuration in our app/web.config file. It declares an appender called `MemoryAppender` which we will access through the C# code later. It also adds a config section under `configSections` so that log4net is configured.
Invoking Log4net's XML Configurator
Follow this post to invoke log4net's XML Configurator.
Converting Logs to a String
To get a string representation of all the logged statements, we use the following code. Note that the `result` variable will be set to the log data.