Skip to content

Instantly share code, notes, and snippets.

View kvprasoon's full-sized avatar
🙏
>_

PRASOON KARUNAN V kvprasoon

🙏
>_
View GitHub Profile
@kvprasoon
kvprasoon / Get-BCinfo
Last active August 29, 2015 14:24
Get Bios Serialnumber,PSComputername,Version,ServicepackMajorversion
foreach($O in "Win32_operatingsystem","win32_bios"){if($O -eq "win32_bios"){$r+=(gwmi $O|select @{E="Serialnumber";L="BIOS Serialnumber"},Pscomputername,@{E={$r.servicepackmajorversion};L="servicepackmajorversion"},@{E={$R.version};L="version"})} else{[array]$r+=(gwmi $O|select @{E={""};L="Serialnumber"},Pscomputername,servicepackmajorversion,version)};$R[1]}
@kvprasoon
kvprasoon / Get-BCinfo
Created July 6, 2015 03:44
Get-BCinfo
gwmi win32_operatingsystem|select CSname,Version,@{E={(gwmi win32_bios).serialnumber};L="Bios SerialNumber"},servicePackMajorVersion
@kvprasoon
kvprasoon / ScriptingGamesAug2015.ps1
Last active August 30, 2015 04:36
A oneliner Which uses JSON
#Invoke-WebRequest -Uri www.telize.com/geoip|select -ExpandProperty content|ConvertFrom-Json|select longitude,latitude,country_code,timezone
function Get-GeoInformation
{
[CmdletBinding()]
[Alias('ggeo')]
param(
[Parameter(ValueFromPipeLine=$true)]
[ValidateNotNull()]
@kvprasoon
kvprasoon / ScriptingGamesSep2015.ps1
Created September 7, 2015 17:41
ScriptingGamesSep
$Cred=Get-Credential;import-csv C:\powershell.org\Input.csv|select -ExpandProperty machinename |foreach{new-object psobject -Property @{'MACHIUNENAME'=$_;'OS VERSION'=$(Get-WmiObject -Class win32_operatingsystem -ComputerName $_ -Credential $cred|select -ExpandProperty caption)}}|Export-Csv C:\powershell.org\Output.csv -NoTypeInformation
@kvprasoon
kvprasoon / ScriptingGamesOct2015.ps1
Last active January 2, 2016 08:28
Get-RSSFeed.ps1
<#
.Synopsis
Shows you the RSS Feeds for given URI.
.DESCRIPTION
This cmdlet Shows you RSS Feeds for a given URI.Results for this cmdlet includes Title,Link and a Short Description for specified Link.
.EXAMPLE
PS C:\WINDOWS\system32> Get-RSSFeed -Uri http://blogs.msdn.com/powershell -OutFilePath C:\Users\PR615733\Documents\RssFeedExample1.csv -OpenAfterExecution -Verbose
Title Link
----- ----
@kvprasoon
kvprasoon / ScriptingGamesJan2016.ps1
Last active January 11, 2016 04:37
ScriptingGamesJan2016
Function Get-Uptime{
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline = $true)]
[String[]]$ComputerName = $env:COMPUTERNAME
)
Begin
{
$Output=@()
@kvprasoon
kvprasoon / Build-ParamLog.ps1
Last active February 27, 2018 18:50
Script to create expressions to print parameter values in a PowerShell script
<#
.SYNOPSIS
This script will help to create expressions for logging the input values of a PowerShell script.
.DESCRIPTION
This script will help to create expressions for logging the input values of a PowerShell script.
.EXAMPLE
PS C:\> .\Build-ParamLog.ps1 -Script C:\Test.PS1 -Prefix Log
Above execution will create expressions with prefix Log, see below.
@kvprasoon
kvprasoon / ScreenShot.ps1
Created March 20, 2018 19:11
Script to save a Screenshot
Param(
[String]$OutFilePath
)
Add-type -AssemblyName System.Drawing
$VirtualScreen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Bmp = New-Object System.Drawing.Bitmap $VirtualScreen.Width, $VirtualScreen.Height
$Graphic = [System.Drawing.Graphics]::FromImage($bmp)
$Graphic.CopyFromScreen($VirtualScreen.Left, $VirtualScreen.Top, 0, 0, $Bmp.Size)
$Bmp.Save($OutFilePath)
@kvprasoon
kvprasoon / Show-Tree.ps1
Last active March 15, 2019 19:28
Cross platform Show-Tree.ps1
<#PSScriptInfo
.VERSION 1.0.0
.GUID 3b5ee706-249d-4108-8126-c8692d603ebc
.AUTHOR Jeffrey Snover
.COMPANYNAME Microsoft Corporation
@kvprasoon
kvprasoon / Pester.Remark.tests.ps1
Last active July 17, 2023 19:26
Pester with remark
param(
[Parameter(Mandatory = $True)]
[string]$ConfigPath
)
$Config = Get-Content -Path $ConfigPath | ConvertFrom-Json
Describe "Describing validation tests post deployment" {
Context "Post deployment validation tests for services" {
BeforeAll {