Coder Social home page Coder Social logo

powershell-functions's People

Contributors

jimbrig avatar pscustomobject avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powershell-functions's Issues

Not an issue just a comment about a specific page on your blog

Hi,
On your site (https://pscustomobject.github.io/powershell/howto/PowerShell-Generate-Unique-Upn/), in the part where you give a sample of use for Test-UPNExist, you write :if ($upnExists -eq $true).
Take care ; alway put $true ou $False on the left of the comparizon (I'm sure you know that).

See this : https://techcommunity.microsoft.com/t5/windows-powershell/powershell-how-to-use-an-if-condition-with-true-false/m-p/3598588

regards.

Issue when a Property Key has no value set

Hi Daniele,
I've discover your function, and I've tested it. Let me show the error I have :

Get-Item @paramGetItem
    Hive: HKEY_CLASSES_ROOT

Name                           Property                                                                                                                                  
----                           --------                                                                                                                                  
search-ms                      (default)        : Windows Search Protocol                                                                                                
                               FriendlyTypeName : @C:\WINDOWS\explorer.exe,-6010                                                                                         
                               URL Protocol     :           

As you can see, the Property URL Protocol have no value set. Then, I have this error :

Exception lors de l'appel de « GetValueKind » avec « 1 » argument(s) : « La clé de Registre spécifiée n'existe pas. »
Au caractère Ligne:121 : 25
+                         [void]($returnData.Add([pscustomobject]@{
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException

However the function returns the other parameters and their values.

Path         : HKEY_CLASSES_ROOT\search-ms
Name         : FriendlyTypeName
Value        : @%SystemRoot%\explorer.exe,-6010
Type         : ExpandString
Computername : LAPTOP-xxxx

Path         : HKEY_CLASSES_ROOT\search-ms
Name         : URL Protocol
Value        : 
Type         : String
Computername : LAPTOP-xxxx

I'm thinking you must add a test

# Append data to return array

                        if ($Null -eq $regItem.GetValueKind($property) ) { $Type = ""}
                        Else { $Type = $regItem.GetValueKind($property)}
                                               
                        [void]($returnData.Add([pscustomobject]@{
                                    'Path'  = $regItem
                                    'Name'  = $property
                                    'Value' = $regItem.GetValue($property, $null, 'DoNotExpandEnvironmentNames')
                                    'Type'  = $Type
                                    'Computername' = $env:computername
                                }))

But i've an error with the (default) parameter (no value, no type)

Exception lors de l'appel de « GetValueKind » avec « 1 » argument(s) : « La clé de Registre spécifiée n'existe pas. »
Au caractère Ligne:121 : 29
+ ...                if ($Null -eq $regItem.GetValueKind($property) ) { $Ty ...
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException

But the display is OK

Path         : HKEY_CLASSES_ROOT\search-ms
Name         : (default)
Value        : 
Type         : 
Computername : LAPTOP-xxxx

Path         : HKEY_CLASSES_ROOT\search-ms
Name         : FriendlyTypeName
Value        : @%SystemRoot%\explorer.exe,-6010
Type         : ExpandString
Computername : LAPTOP-xxxx

Path         : HKEY_CLASSES_ROOT\search-ms
Name         : URL Protocol
Value        : 
Type         : String
Computername : LAPTOP-xxxx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.