Skip to content

Commit

Permalink
check reg value to use Get-ItemPropertyValue
Browse files Browse the repository at this point in the history
check for a reg value will now use Get-ItemPropertyValue instead of
Get-ItemProperty
  • Loading branch information
rzander committed Jan 3, 2018
1 parent d2c8575 commit 6b17168
Show file tree
Hide file tree
Showing 18 changed files with 367 additions and 283 deletions.
4 changes: 1 addition & 3 deletions Source/REG2CI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Diagnostics;

Expand All @@ -14,7 +12,7 @@ static int Main(string[] args)
{
bool bX64 = true;
List<string> lArgs = args.ToList();
Console.WriteLine("****** Reg2CI (c) 2017 by Roger Zander ******");
Console.WriteLine("****** Reg2CI (c) 2018 by Roger Zander ******");
if(lArgs.Count == 0 || lArgs.Contains("-?") || lArgs.Contains("/?"))
{
Console.WriteLine("Usage: Reg2CI.exe <Reg File> <Cab File> <Name of the CI> [/X86]");
Expand Down
6 changes: 3 additions & 3 deletions Source/REG2CI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zander Tools")]
[assembly: AssemblyProduct("REG2CI")]
[assembly: AssemblyCopyright("Copyright © 2017 by Roger Zander")]
[assembly: AssemblyCopyright("Copyright © 2018 by Roger Zander")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.3.*")]
[assembly: AssemblyFileVersion("0.7.3.2")]
[assembly: AssemblyVersion("0.7.4.*")]
[assembly: AssemblyFileVersion("0.7.4.0")]
11 changes: 5 additions & 6 deletions Source/REG2CI/RegClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml;

Expand All @@ -17,7 +16,7 @@ public class RegFile
public static bool bPSScript = true;
public static XmlDocument xDoc = new XmlDocument();
internal static string LogicalName = "";
public string Description = "Reg2CI (c) 2017 by Roger Zander";
public string Description = "Reg2CI (c) 2018 by Roger Zander";

public RegFile(string fileName, string CIName)
{
Expand Down Expand Up @@ -471,17 +470,17 @@ public string PSCheck

if (DataType == ValueType.Binary)
{
return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -join ',' -eq ({VALUE} -join ',')) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
return "if((Get-ItemPropertyValue -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue) -join ',' -eq ({VALUE} -join ',')) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
}

if (DataType == ValueType.MultiString)
{
return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -join ',' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
return "if((Get-ItemPropertyValue -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue) -join ',' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
}

string sResult = _svalue.Replace(@"\""", @"`""");
return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", sResult);

//return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", sResult);
return "if((Get-ItemPropertyValue -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue) -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", sResult);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions Source/REG2PS/Default.Master
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<meta name="description" content="Convert PowerShell scripts into Windows executables." />
<meta name="keywords" content="Powershell, PoSh, registry, convert, reg, ps1, script" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="text/javascript" src="Scripts/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="Scripts/bootstrap.min.js"></script>
<link rel="stylesheet" href="Content/bootstrap.css" />

Expand All @@ -47,14 +47,14 @@
</asp:ScriptManager>
<div class="container">
<h1>Registry to PowerShell converter</h1>
<p class="text-muted"><sup>Version 1.0.2.2 (1.July.2017)</sup></p>
<p class="text-muted"><sup>Version 1.0.3.0 (3.Jan.2018)</sup></p>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</form>
<footer class="rfooter">
<div class="container">
<p class="text-muted"><a href="https://github.com/rzander/REG2CI/" title="REG2PS on GitHub">REG2PS on GitHub...</a> Copyright © 2017 by Roger Zander</p>
<p class="text-muted"><a href="https://github.com/rzander/REG2CI/" title="REG2PS on GitHub">REG2PS on GitHub...</a> Copyright © 2018 by Roger Zander</p>
</div>
</footer>
</body>
Expand Down
6 changes: 3 additions & 3 deletions Source/REG2PS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REG2PS")]
[assembly: AssemblyCopyright("Copyright © 2017 by Roger Zander")]
[assembly: AssemblyCopyright("Copyright © 2018 by Roger Zander")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.2.2")]
[assembly: AssemblyFileVersion("1.0.2.2")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
9 changes: 5 additions & 4 deletions Source/REG2PS/RegClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class RegFile
public static bool bPSScript = true;
public static XmlDocument xDoc = new XmlDocument();
internal static string LogicalName = "";
public string Description = "Reg2CI (c) 2017 by Roger Zander";
public string Description = "Reg2CI (c) 2018 by Roger Zander";

public RegFile(string fileName, string CIName)
{
Expand Down Expand Up @@ -451,16 +451,17 @@ public string PSCheck

if (DataType == ValueType.Binary)
{
return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -join ',' -eq ({VALUE} -join ',')) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
return "if((Get-ItemPropertyValue -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue) -join ',' -eq ({VALUE} -join ',')) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
}

if (DataType == ValueType.MultiString)
{
return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -join ',' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
return "if((Get-ItemPropertyValue -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue) -join ',' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", _svalue);
}

string sResult = _svalue.Replace(@"\""", @"`""");
return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", sResult);
//return "if((Get-ItemProperty -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue).'{NAME}' -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", sResult);
return "if((Get-ItemPropertyValue -Path '{PATH}' -Name '{NAME}' -ea SilentlyContinue) -eq {VALUE}) { $true } else { $false }".Replace("{PATH}", PSHive + "\\" + Path).Replace("{NAME}", Name).Replace("{VALUE}", sResult);
}
else
{
Expand Down
4 changes: 0 additions & 4 deletions Source/REG2PS/Scripts/jquery-3.1.1.min.js

This file was deleted.

1 change: 0 additions & 1 deletion Source/REG2PS/Scripts/jquery-3.1.1.min.map

This file was deleted.

4 changes: 0 additions & 4 deletions Source/REG2PS/Scripts/jquery-3.1.1.slim.min.js

This file was deleted.

1 change: 0 additions & 1 deletion Source/REG2PS/Scripts/jquery-3.1.1.slim.min.map

This file was deleted.

Loading

0 comments on commit 6b17168

Please sign in to comment.