├── .gitattributes ├── .gitignore ├── App.config ├── PSUnlock.csproj ├── PSUnlock.sln ├── Program.cs ├── Properties └── AssemblyInfo.cs ├── README.md └── bin └── Release ├── PSUnlock.exe ├── PSUnlock.exe.config ├── PSUnlock.pdb ├── PSUnlock.vshost.exe ├── PSUnlock.vshost.exe.config └── PSUnlock.vshost.exe.manifest /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | PowerShdll.zip 49 | 50 | ## Ignore Visual Studio temporary files, build results, and 51 | ## files generated by popular Visual Studio add-ons. 52 | ## 53 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 54 | 55 | # User-specific files 56 | *.suo 57 | *.user 58 | *.userosscache 59 | *.sln.docstates 60 | 61 | # User-specific files (MonoDevelop/Xamarin Studio) 62 | *.userprefs 63 | 64 | # Build results 65 | [Dd]ebug/ 66 | [Dd]ebugPublic/ 67 | bld/ 68 | [Oo]bj/ 69 | [Ll]og/ 70 | 71 | # Visual Studio 2015 cache/options directory 72 | .vs/ 73 | # Uncomment if you have tasks that create the project's static files in wwwroot 74 | #wwwroot/ 75 | 76 | # MSTest test Results 77 | [Tt]est[Rr]esult*/ 78 | [Bb]uild[Ll]og.* 79 | 80 | # NUNIT 81 | *.VisualState.xml 82 | TestResult.xml 83 | 84 | # Build Results of an ATL Project 85 | [Dd]ebugPS/ 86 | [Rr]eleasePS/ 87 | dlldata.c 88 | 89 | # .NET Core 90 | project.lock.json 91 | project.fragment.lock.json 92 | artifacts/ 93 | **/Properties/launchSettings.json 94 | 95 | *_i.c 96 | *_p.c 97 | *_i.h 98 | *.ilk 99 | *.meta 100 | *.obj 101 | *.pch 102 | *.pdb 103 | *.pgc 104 | *.pgd 105 | *.rsp 106 | *.sbr 107 | *.tlb 108 | *.tli 109 | *.tlh 110 | *.tmp 111 | *.tmp_proj 112 | *.log 113 | *.vspscc 114 | *.vssscc 115 | .builds 116 | *.pidb 117 | *.svclog 118 | *.scc 119 | 120 | # Chutzpah Test files 121 | _Chutzpah* 122 | 123 | # Visual C++ cache files 124 | ipch/ 125 | *.aps 126 | *.ncb 127 | *.opendb 128 | *.opensdf 129 | *.sdf 130 | *.cachefile 131 | *.VC.db 132 | *.VC.VC.opendb 133 | 134 | # Visual Studio profiler 135 | *.psess 136 | *.vsp 137 | *.vspx 138 | *.sap 139 | 140 | # TFS 2012 Local Workspace 141 | $tf/ 142 | 143 | # Guidance Automation Toolkit 144 | *.gpState 145 | 146 | # ReSharper is a .NET coding add-in 147 | _ReSharper*/ 148 | *.[Rr]e[Ss]harper 149 | *.DotSettings.user 150 | 151 | # JustCode is a .NET coding add-in 152 | .JustCode 153 | 154 | # TeamCity is a build add-in 155 | _TeamCity* 156 | 157 | # DotCover is a Code Coverage Tool 158 | *.dotCover 159 | 160 | # Visual Studio code coverage results 161 | *.coverage 162 | *.coveragexml 163 | 164 | # NCrunch 165 | _NCrunch_* 166 | .*crunch*.local.xml 167 | nCrunchTemp_* 168 | 169 | # MightyMoose 170 | *.mm.* 171 | AutoTest.Net/ 172 | 173 | # Web workbench (sass) 174 | .sass-cache/ 175 | 176 | # Installshield output folder 177 | [Ee]xpress/ 178 | 179 | # DocProject is a documentation generator add-in 180 | DocProject/buildhelp/ 181 | DocProject/Help/*.HxT 182 | DocProject/Help/*.HxC 183 | DocProject/Help/*.hhc 184 | DocProject/Help/*.hhk 185 | DocProject/Help/*.hhp 186 | DocProject/Help/Html2 187 | DocProject/Help/html 188 | 189 | # Click-Once directory 190 | publish/ 191 | 192 | # Publish Web Output 193 | *.[Pp]ublish.xml 194 | *.azurePubxml 195 | # TODO: Comment the next line if you want to checkin your web deploy settings 196 | # but database connection strings (with potential passwords) will be unencrypted 197 | *.pubxml 198 | *.publishproj 199 | 200 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 201 | # checkin your Azure Web App publish settings, but sensitive information contained 202 | # in these scripts will be unencrypted 203 | PublishScripts/ 204 | 205 | # NuGet Packages 206 | *.nupkg 207 | # The packages folder can be ignored because of Package Restore 208 | **/packages/* 209 | # except build/, which is used as an MSBuild target. 210 | !**/packages/build/ 211 | # Uncomment if necessary however generally it will be regenerated when needed 212 | #!**/packages/repositories.config 213 | # NuGet v3's project.json files produces more ignorable files 214 | *.nuget.props 215 | *.nuget.targets 216 | 217 | # Microsoft Azure Build Output 218 | csx/ 219 | *.build.csdef 220 | 221 | # Microsoft Azure Emulator 222 | ecf/ 223 | rcf/ 224 | 225 | # Windows Store app package directories and files 226 | AppPackages/ 227 | BundleArtifacts/ 228 | Package.StoreAssociation.xml 229 | _pkginfo.txt 230 | *.appx 231 | 232 | # Visual Studio cache files 233 | # files ending in .cache can be ignored 234 | *.[Cc]ache 235 | # but keep track of directories ending in .cache 236 | !*.[Cc]ache/ 237 | 238 | # Others 239 | ClientBin/ 240 | ~$* 241 | *~ 242 | *.dbmdl 243 | *.dbproj.schemaview 244 | *.jfm 245 | *.pfx 246 | *.publishsettings 247 | orleans.codegen.cs 248 | 249 | # Since there are multiple workflows, uncomment next line to ignore bower_components 250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 251 | #bower_components/ 252 | 253 | # RIA/Silverlight projects 254 | Generated_Code/ 255 | 256 | # Backup & report files from converting an old project file 257 | # to a newer Visual Studio version. Backup files are not needed, 258 | # because we have git ;-) 259 | _UpgradeReport_Files/ 260 | Backup*/ 261 | UpgradeLog*.XML 262 | UpgradeLog*.htm 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | 274 | # Microsoft Fakes 275 | FakesAssemblies/ 276 | 277 | # GhostDoc plugin setting file 278 | *.GhostDoc.xml 279 | 280 | # Node.js Tools for Visual Studio 281 | .ntvs_analysis.dat 282 | node_modules/ 283 | 284 | # Typescript v1 declaration files 285 | typings/ 286 | 287 | # Visual Studio 6 build log 288 | *.plg 289 | 290 | # Visual Studio 6 workspace options file 291 | *.opt 292 | 293 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 294 | *.vbw 295 | 296 | # Visual Studio LightSwitch build output 297 | **/*.HTMLClient/GeneratedArtifacts 298 | **/*.DesktopClient/GeneratedArtifacts 299 | **/*.DesktopClient/ModelManifest.xml 300 | **/*.Server/GeneratedArtifacts 301 | **/*.Server/ModelManifest.xml 302 | _Pvt_Extensions 303 | 304 | # Paket dependency manager 305 | .paket/paket.exe 306 | paket-files/ 307 | 308 | # FAKE - F# Make 309 | .fake/ 310 | 311 | # JetBrains Rider 312 | .idea/ 313 | *.sln.iml 314 | 315 | # CodeRush 316 | .cr/ 317 | 318 | # Python Tools for Visual Studio (PTVS) 319 | __pycache__/ 320 | *.pyc 321 | 322 | # Cake - Uncomment if you are using it 323 | # tools/** 324 | # !tools/packages.config 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs -------------------------------------------------------------------------------- /App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /PSUnlock.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {36EBF9AA-2F37-4F1D-A2F1-F2A45DEEAF21} 8 | Exe 9 | Properties 10 | PSUnlock 11 | PSUnlock 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | False 46 | ..\..\..\..\..\..\..\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /PSUnlock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSUnlock", "PSUnlock.csproj", "{36EBF9AA-2F37-4F1D-A2F1-F2A45DEEAF21}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {36EBF9AA-2F37-4F1D-A2F1-F2A45DEEAF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {36EBF9AA-2F37-4F1D-A2F1-F2A45DEEAF21}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {36EBF9AA-2F37-4F1D-A2F1-F2A45DEEAF21}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {36EBF9AA-2F37-4F1D-A2F1-F2A45DEEAF21}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.ObjectModel; 4 | using System.Management.Automation; 5 | using System.Management.Automation.Runspaces; 6 | using System.IO; 7 | using System.Diagnostics; 8 | using System.Runtime.InteropServices; 9 | 10 | namespace PSUnlock 11 | { 12 | static class Program 13 | { 14 | 15 | static void Usage() { 16 | Console.WriteLine("Usage:\nRun A Powershell Command: PSUnlock.exe