WordPress PowerShell Syntax Highlighting how to

#PowerShell WordPress syntax Highlighting IT WORKS! 

1. Download http://wordpress.org/extend/plugins/syntax-highlighter/installation/
2. Go to wordpress–> plugins –>ADD NEW –> Chose File (u downloaded)–>  Install Now
3. The image with red marks shows syntax hightligher powershell open and close tag –

(It took me way to long to figure out what the start stop tags were

hence the image /photo on left  with red maker underling the CODE!

START TAG [
language="powershell" ]
foo script
[/code]
END TAG
#IT WORKS!
if ($c -eq "Cat")
 { $a="Bubble" }
 else
 { $a="Trouble" }
Write-Host $a
 [/code]

share with friends

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to Odnoklassniki
0 Comments

Powershell: loop from text file line by line + more

  • Grab every file in specified folder/directory
  • Read each file line by line
  • Create / append new file from output
  • After file has been created join / merge to file
  • Merge header & footer Files plus new file into one  large file
#Folder of something
#grab the flies
Get-ChildItem C:\Users\Desktop\powershell\vmat\itnetlabsVAMT\ -Recurse |
 Where {$_ -IS [IO.FileInfo]} |
#GET CONTENT $_ means each line from get content
gc $_ | ForEach-Object {

 #Shows what you grabbed
write-host ($_)

######################
#write the output to a file
write-output ' <Computer Name="'($(_))'"
 OSVersion="" OSEdition="" NetworkType="Domain" NetworkName="
" Id="bac224">
 <MacAddresses />
<Products>
<Product>
<Sku Id="00000x00-0000-0000-0000-0x00" Name=""
ApplicationId="5c3f16059f" Description="" />
<LicenseInfo LicenseStatus="Unknown" LicenseStatusReason="0"
 GracePeriodRemaining="0" GenuineStatus="Unknown"
TokenEnabled="false" LicenseIsAddon="false" />
<Version />
<PartialProductKey />
<ProductKeyId />
<KeyType>Unknown</KeyType>
<InstallationId />
<ConfirmationId />
<LastErrorCode>0</LastErrorCode>
<LastActionState />
<LastUpdateTime>2012-03-08T10:39:24.0468d-06:00</LastUpdateTime>
<LicenseFamily />
</Product>
</Products>
</Computer>
</Computers>'
} | Out-File $($pathName + "_DUMP.txt")
#ABOVE LINE PIPe OUTPUT TO TEXT FILE
#MAKES A TEXT FILE
New-Item -ItemType file "big.cli"
#merges the files
$file1 = Get-Content "header.txt"
$file2 = Get-Content $($pathName + "_DUMP.txt")
$file3 = Get-Content "Footer.txt"
Add-Content "big.cli" $file1
Add-Content "big.cli" $file2
Add-Content "big.cli" $file3

<code></pre></code>
<code>

[\powershell]

share with friends

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to Odnoklassniki
1 Comment

Learning powershell: scripting User Accounts in Active Directory

Powershell scripting users
I would recommend building out a testing domain controller using oracle virtual box.(SAND BOX TESTING!)
Lets get start making some users to test with powershell.

A. Use this CSV from StarTrek user list CSV FIIL  (http://www.powershell.nu/2009/04/13/part-11-adding-ou-structure-using-powershell/ ::: a awesome site )

You can also create more users by grabbing them from  http://fake.name-generator.co/index.php

 

 

 

share with friends

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to Odnoklassniki
0 Comments