Konstantin Vlasenko

An engineer is someone who can make for a dollar what any fool could make for two. – Alan Kay

Category Archives: PowerSlim

PowerShell: Wait for SQL Server is ready for client connections

The useful PowerShell script waiting SQL server is ready. I found that waiting for starting service while((get-service MSSQL`$INSTANCENAME).Status -ne ‘Running’){Sleep 3} is not enough. Better to check the event log entry EventID = 17126: SQL Server is now ready for client connections. This is an informational message; no user action is required. $ew = new-object [...]

PowerShell: Create CSV without Header

get-process | ConvertTo-CSV -NoTypeInformation | select -Skip 1

PowerShell: Download File

(new-object System.Net.WebClient).DownloadFile(‘http://macosoft.gnom/files/xon.png’, ‘c:\xon.png’)

Windows Server 2008 Core DCPROMO

dcpromo.exe /unattend /replicaOrNewDomain:domain /newDomain:forest /newDomainDnsName:velaskec.com /domainNetbiosName:velaskec /safeModeAdminPassword:pa$$word

Removing Password Complexity Requirements from Windows Server 2008 Core

Use this PowerShell script if you need to remove Password Complexity Requirements from Windows Server 2008 Core: secedit /export /cfg c:\new.cfg ${c:new.cfg}=${c:new.cfg} | % {$_.Replace(‘PasswordComplexity=1′, ‘PasswordComplexity=0′)} secedit /configure /db $env:windir\security\new.sdb /cfg c:\new.cfg /areas SECURITYPOLICY del c:\new.cfg

PowerSlim v0.6

PowerSlim v0.6 Fixed: #3: use variables with prefix! #4: [DateTime]::Now doesn’t work

PowerSlim v0.5 available

The new Remote feature available. How it works: 1. Run PowerSlim server on the remote COMPUTER PowerShell -executionpolicy unrestricted -file .\slim.ps1 35 server 2. !define COMMAND_PATTERN (PowerShell -executionpolicy unrestricted -file .\slim.ps1) 3. |Query:Remote|Computer|Get-Service| |DisplayName|Status| 4. Click TEST button.

How to start with PowerSlim

Install PowerShell (Windows 7 and Windows 2008 R2 already integrated with PowerShell) Download latest fitnesse.jar file java -jar fitnesse.jar. It’ll install itself Unpack the latest PowerSlim into fitnesse folder. It will put the slim.ps1 file in it. open localhost:80/PowerSlim Click Suite button

#PowerShell HowTo get the property of the object from the previous pipe level

[System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”) function Get-SPSite{ $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local $farm.services | % {if($_.WebApplications.Count){$_.WebApplications}} | % {if($_.sites.Count){$_.sites}} } function Get-SPUser { process { $_ | Add-Member -memberType NoteProperty -name “Site” -value $Site.Url $_ | Add-Member -memberType NoteProperty -name “Title” -value $Site.RootWeb.Title $_ | Add-Member -memberType NoteProperty -name “Group” -value $Group.Name $_ } } Get-SPSite | % {$Site = $_;$_.RootWeb.Groups} [...]

PowerShell trick

Do you know how to change the script below to make it true? ((‘first’,’second’))[0][1] -eq ((‘first’,’second’),(‘first’,’second’))[0][1] I want to get ‘second‘ from the left operand ((‘first’,’second’))[0][1] (,(‘first’,’second’))[0][1] comma is not a solution as it will not work for (,(‘first’,’second’),(‘first’,’second’))[0][1] (,(‘first’,’second’))[0][1] -eq (,(‘first’,’second’),(‘first’,’second’))[0][1] will still return False

Follow

Get every new post delivered to your Inbox.