Convert from Powershell to vb.net

Welcome Forums General PowerShell Q&A Convert from Powershell to vb.net

Viewing 1 reply thread
  • Author
    Posts
    • #165196
      Participant
      Topics: 1
      Replies: 0
      Points: 12
      Rank: Member

      Good Afternoon,

      i’m sorry to ask, but i’m really noob with powershell and i’m struggling with this bunch of code,  this  will be a part of a link that is generated(see below).

      it convert our guid document saved for example “”9999999999199012537”

      in an OID that will be a part of the string that composed this website, in this way it works, but i need to convert it to vb, and you will say why? because i want to integrate on my consol application for an internal use.  Do you have any Idea?

      $link= “http://test.$branch.net:7408/edoc/main?object=document&method=stream&watermark=true&OID=“+ (ConvertTo-Oid -guid $eDocTable[$eDocIndex].G_U_I_D)

      Param([Parameter(Position=0, Mandatory=$true)]  [String] $guid)
      
      $guidClass = (($guid -shr 60) -band 15)
      
      $guidID    = (($guid -band 0x0FFFFFFFFFFFFFFFL) -shr (60 - ($guidClass * 4)))
      
      $guidValue = $guid -band (0x0FFFFFFFFFFFFFFFL -shr ($guidClass * 4))
      
      #Assemble result
      
      if (($guidClass -eq 0) -and ($guidID -eq 0)) {
      
      # Handle special case
      
      return "0-" + '{0:X}' -f $guidValue
      
      }
      
      else{
      
      return ("" + ('{0:X}' -f $guidClass) + "" + ('{0:X}' -f $guidID) + "-" + ('{0:X}' -f $guidValue))
      
      }
      
      }
      
      

      Thank you,

      have a great day!

    • #165748
      Senior Moderator
      Topics: 8
      Replies: 1215
      Points: 4,335
      Helping Hand
      Rank: Community Hero

      Yes, why ? Can you give more details on why VB is required here, somebody might be able to help you in that.

Viewing 1 reply thread
  • The topic ‘Convert from Powershell to vb.net’ is closed to new replies.