Archive

Archive for March, 2017

Who & What Will Control Innovation

The real danger as I see it for coming generations is who will be the innovators? Man or Machine(AI)? If you have an idea; I’m not sure if any of the search engines are the best for finding or searching for similar thoughts. However, search for better mousetrap and you’ll find lots of ideas on mousetraps. Now search with one of your own ideas, 99% of the time there will be similar ideas to your own. If by chance you don’t find anything that remotely resembles your idea you might have something and be the 1%. That 1% could be the innovative idea of the decade.

Now back to search engines. All search engines store (questions, queries, search terms) asked of it. What bothers me is what happens if you did find the (1%, .001%) and have something so unique that it will benefit everyone and make you rich? It’s possible the search engines have a small search term bot that monitors when a new query hits the system that is a (1%, .001%), that automatically files a utility patent, trade mark or whatever. Google already returns how fast it finds results at the top of the page. I also believe the .gov patent site also logs new patent search terms. Think Tesla. Maybe Library’s aren’t so bad after all.

It might not even happen like this. And, yet if we don’t remain vigilant with new and fresh ideas…
Who are the real innovators? TBD. 🙂

Pineapple. A little gold never hurt anyone. :-)

This image took awhile to put together. I’m finding that making cloths and sizing challenging. But, once together can render some cool stuff.

Categories: #kravis, 3D, ART, MODELING

PowerShell – Out-GridView Headers (Using Get-Process)

March 13, 2017 1 comment

PowerShell – Out-GridView Headers with Get-Process

I thought I would do a follow-up on a previous post about using out-GridView with Headers and use Get-Process this time.  Although this post is
similar to prior post, I’ve shortened a few things in regards to my collection of header information.

($A = Get-Process) | Out-GridView or OGV

Essentially the $A is creating a variable/collection of items and displays without column names.
Use $A.GetType() and as you see the object type is a collection(System.Array).

At this point $A returns the items that are in the collection including the headers that are automatically created and are the names that will be
used for our header object.

the $A and Get-Process with Out-Gridview/OGV both return the same results with out our extra header information. 

Discovering what makes up the header can be found by using the following commands.

The first item displays all the available Member Types available for $A.
$A | Get-member -MemberType *
Here is a mini sub-set of items that are displayed. I find it a tad strange that all items were not created as an AliasProperty.

The first 7 items identified as AliasProperty are used as the column headings from $A.
$A | Get-member -MemberType ‘AliasProperty’

$A | Get-member -MemberType ‘ScriptProperty’

Headings to be used from Get-member functions are:
Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id  SI ProcessName

Data to populate the tables arrives in the following form:
Handles AliasProperty Handles = Handlecount
Name AliasProperty Name = ProcessName
NPM AliasProperty NPM = NonpagedSystemMemorySize64
PM AliasProperty PM = PagedMemorySize64
SI AliasProperty SI = SessionId
VM AliasProperty VM = VirtualMemorySize64
WS AliasProperty WS = WorkingSet64
Id                         Property       int Id {get;}
CPU                   ScriptProperty System.Object CPU {get=$this.TotalProcessorTime.TotalSeconds;}

Running get-help get-process -full returns information about Get-Process.


This shows what the values are for column headings.  SessionID does not appear in the help file. ( there is a lot more information then what I’ve displayed)

Now that I’ve shown where the fields are for the headers that will be used for reporting lets build the Report-Header object.
Create an object to hold header values

$TestProperties = new-Object Object

By itself $TestProperties only returns the System.Object

Now lets setup the Properties we want in our object.
add-Member -inputobject $TestProperties -MemberType NoteProperty -Name “Handles” -Value “Handles
add-Member -inputobject $TestProperties -MemberType NoteProperty -Name “NPM” -Value “NPM(K)
add-Member -inputobject $TestProperties -MemberType NoteProperty -Name “PM” -Value “PM(K)
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “WS” -Value “WS(K)
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “VM” -Value “VM(K)
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “CPU” -Value “CPU(s)
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “Id” -Value “Id
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “SI” -Value “SI
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “ProcessName” -Value “ProcessName

I kept the values in the same order that Get-Process returns.

What I’m doing is creating an initialized array with values that will be used as the header of a report. For this example of working with Report-Headers I’ve used Get-Process to show that it’s pretty darn easy to quickly add report headers for use in OGV or Out-GridView functions.

At this point I have an collection/array that contains 1 initialized record of straight text that will be used for Out-GridView.

Without placing the statements into a function here is what you see when running $TestProperties | Out-GridView


There 1 initialized record showing headings. 🙂

Now that there is an initialized collection of header information we can combine $A and $TestProperties and generate our Out-GridView.

Ooops. 🙂 $TestProperties is not the type that allows for joining objects of data together.  You’ll need to create your collection/array to something

like this  $local:TestCollection = @() But it’s just as easy to create a simple function

function Report-Headers() {
# There are a few methods for createing objects. Keeping this simple
# to show the possibilities

# Sets up an empty object with header names for use in out-gridview
$local:TestCollection = @()

# Create a new object with the same values as in ($A = Get-Process) to hold header names
$TestProperties = new-Object Object
add-Member -inputobject $TestProperties -membertype NoteProperty -Name “Handles” -Value “Handles”
add-Member -inputobject $TestProperties -membertype NoteProperty -Name “NPM” -Value “NPM(K)”
add-Member -inputobject $TestProperties -membertype NoteProperty -Name “PM” -Value “PM(K)”
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “WS” -Value “WS(K)”
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “VM” -Value “VM(K)”
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “CPU” -Value “CPU(s)”
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “Id” -Value “Id”
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “SI” -Value “SI”
add-Member -InputObject $TestProperties -MemberType NoteProperty -Name “ProcessName” -Value “ProcessName”

$local:TestCollection += $TestProperties
$global:ReportHeaders = $local:TestCollection
}

I realize that there are similar ways to solve this issue.  However this is simple and works.

$Global:ReportHeaders | out-gridview

Please keep in mind that I’m not doing any calculations on the field values.  This is just a simple method for creating report headers if they are needed.

Well that’s it for this post.  Comments and suggestions are always welcome.

 

 

 

Love Is Worth Fighting For

Still on my quest to learn about digital 3D art.

This image was fun to pose and set up the entire scene. As in real life I used hair light, key light to right and fill light on left.
I did some work in Photoshop and rendered the image in DAZ3D.

Please book a Photo session if you’d like to combine real life photoraphy with 3d art.

Categories: #kravis, 3D, ART, MODELING

PowerShell :- Certificate Object Model Creation Part 2

March 4, 2017 2 comments

Certificate Object Model Creation Part 2

I’ll start by drilling down into the cert collection items section by section. (Place holder for now) 

PowerShell :- Certificate Object Model Creation Part 1

March 4, 2017 2 comments

Certificate Object Model Creation Part 1

An object model is a logical interface, software or system that is modeled through the use of object-oriented techniques. It enables the creation of an architectural software or system model prior to development or programming. An object model is part of the object-oriented programming (OOP) lifecycle.
What is an Object Model? – Definition from Techopedia
https://www.techopedia.com/definition/8635/object-model

What I’ve created is a representation, (work in progress) that represents an object model for a certificate using PowerShell and by creating XML that can be loaded into a database further analysis can be performed on results. Using a DTD assists with well-formed XML. I’ve been considering adding MongoDB into the mix and will do so shortly. Currently all certs on my machine(s) can be read and placed into an SQLServer Database.

I’ll start by going over steps and functions to load the certs on a machine into a collection. I’ll begin by loading a function to create to create $global:CertCollection. I used simple method to compress RawData to include a comma separator for that field. I will go over using TypeLib’s to assist with other field values in another post.
Let’s do some pre-setup so the command will run
Import-Module PKI
Set-Location Cert:\LocalMachine

function Build-GlobalCert()
{
##
### Builds collection from under root
## Ran with out ` line continuation all should be on one line.
$global:CertCollection = GET-CHILDITEM –RECURSE | Select-Object -Property “PSPath”,
“PSParentPath”, “PSChildName”, “PSDrive”, “PSProvider”, “PSIsContainer”, “EnhancedKeyUsageList”, “DnsNameList”,
“SendAsTrustedIssuer”, “EnrollmentPolicyEndPoint”, “EnrollmentServerEndPoint”, “PolicyId”, “Archived”, “Extensions”, “FriendlyName”, “IssuerName”,
“NotAfter”, “NotBefore”, “HasPrivateKey”, “PrivateKey”, “PublicKey”, “SerialNumber”, “SubjectName”, “SignatureAlgorithm”, “Thumbprint”, “Version”, “Handle”, “Issuer”,
“Subject”, @{ Name = “RawData”; Expression = { ([string]::Join(“,”, $_.RawData)) } }
}
##Call or run your function:
Build-GlobalCert

And that generates the collection we can work with running $global:certcollection returns all items in the collection.
$global:certcollection[$global:certcollection.count-1] entering this command displays the last record contained in the collection.

If you’re working from command line and don’t want to type full item each time you can shorten into a single variable.
$lastCert = $global:certcollection[$global:certcollection.count-1]
$lastcert
lastcertincollection

By looking at the output I decided to create the XML following the pattern the output revealed.
Using a simple tool like XMLNotePad from Microsoft will allow you to quickly work on xml for an object model representation using XML.
It’s a free tool and you don’t require much to understand the concept. Search msdn.com and you should find it.

certobjectmodelxmlcoll

In my next post I’ll start the drill down process into the collection to build the XML/Object Model
Next post is Certificate Object Model Creation Part 2

PowerShell :- Certificate Store Navigation

COMMENTS ARE ALWAYS WELCOMED ON MY POSTS:

STARTING OUT

For starters there are several methods for working and viewing certificates. These are the steps I took while digging into certs. I’ll try and go over things in a top down fashion so it will be easy to follow along.

When starting in PowerShell and running as administrator the default location is c:\windows\system32. I like changing or creating a temp directory where commands and output can be traced quickly by having all items in one central location. Your PowerShell Profile should be setup to use a different folder as your starting folder.  Standard output items could end up in c:\windows\system32 and I’d rather not clutter up that folder with extra output that really should not be in that folder.

(Get-Help about_profiles) is a good starting point when reading about profiles.
Example set your location to use the home path: Set-Location $env:homepath.
Setting your to something different all should be ok.  For running my examples I’m going to Set-Location to the PSPATH “CERT”.

Import the PKI Module if you have the IMPORT-MODULE PKI in your PowerShell profile you won’t have to import the module as it will already be there.importmodulepki

You can and should set your default directory in your $Profile

setlocation

I’m setting location to “CERT” as this is where I want to start out. With out the semicolon at the end of CERT:
you’ll receive an error so just re-enter and add :.

setlocationcert

Clear the host that’s more for me at this point so I could have a clean capture. 🙂

clearhost

Running GET-CHILDITEM shows us the certificate stores located on the machine for the current user and
local machine. You can SET-LOCATION  to either CurrentUser or LocalMachine.  For now I’ll go with LocalMachine

setlocationcert

And, once in CERT:/ SET-LOCATION CurrentUser then run GET-CHILDITEM.

The certmgr screen can be assessed via command line with this command Invoke-item CERT:

commandguicert

There are some differences in appearance but essentially can do the same with both interfaces. In another post I’ll go over the GUI screen.

Switch to the LocalMachine area. SET-LOCATION CERT:\LocalMachine

certslocalmachine

 

 

So, far we’ve setup to begin working with certificates. The following is a listing of commands that can be used
while working with certificates.
For Source you can see that PKI is listed. That’s because we IMPORTED-MODULE PKI

getcommandcert

You can also run this command to get a sorted list. (I’m using Source)
GET-COMMAND *CERT* | Sort-Object -Descending Source

certcommandsdescending

Next post is Certificate Object Model Creation Part 1