Home
- Details
- Written by: po3dno
- Category: C#
- Hits: 293
@echo off
REM Extracts all .dll files from nugets in this folder or its subfolders and copies them to a subfolders
REM .
REM Note: Uses .NET 4.5 to unzip the nugets. If this fails, use 7zip or something similar.
REM See http://stackoverflow.com/questions/17546016/how-can-you-zip-or-unzip-from-the-command-prompt-using-only-windows-built-in-ca/26843122#26843122
echo Extracting all dlls from nugets to folder \extracted-dlls
REM %mypath% is where the batch file is located
set mypath=%~dp0
set temppath=%~dp0temp\
set dllpath=%~dp0extracted-dlls\
REM Delete old dlls
echo Deleting old files
rd /s /q %dllpath%"
mkdir %dllpath%
rem traverse all nupkg files
pushd %mypath%
for /r %%a in (*.nupkg) do (
echo \- Processing %%~nxa
REM unzip nuget to %temppath% folder.
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%%a', '%temppath%'); }
REM Copy all dlls
REM See: http://stackoverflow.com/questions/11720681/windows-batch-copy-files-from-subfolders-to-one-folder
pushd %temppath%
for /r %%b in (*.dll) do (
echo \- Found %%~nxb
COPY "%%b" "%dllpath%%%~nxb"
)
popd
REM Delete Temp folder
rd /s /q %temppath%"
)
popd
pause
- Details
- Written by: po3dno
- Category: Windows
- Hits: 247
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
nuget add new_package.1.0.0.nupkg -source \\myserver\packages
Setup Proxy
First you’ll need to tell your PowerShell session to use your proxy. You might also need to change the TLS protocol that’s accepted. Basically, what’s happening above is just a bad error message. It’s not verbose enough to say “HTTPS failure” or anything like that.
$proxy = '<YOUR CORPORATE PROXY HERE>' # update this
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy($proxy)
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
Update Package Providers
This is similar-ish to sudo apt-get update. The first line gives you the package provider itself, the second registers PSGallery and the third installs PowerShellGet, which is basically an installer that a lot of packages use.
Install-PackageProvider -Name nuget -Scope AllUsers -Confirm:$false -Force -MinimumVersion 2.8.5.201
Register-PSRepository -Default -verbose
Install-Module -Name PowerShellGet -Scope AllUsers -Confirm:$false -Force -AllowClobber -MinimumVersion 2.2.4 -SkipPublisherCheck
- Details
- Written by: po3dno
- Category: Windows
- Hits: 239
If you used Group Policy, disable the Group Policy setting that you used to enable Windows Defender Credential Guard (Computer Configuration -> Administrative Templates -> System -> Device Guard -> Turn on Virtualization Based Security).
Delete the following registry settings:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\LSA\LsaCfgFlags
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\LsaCfgFlags
If you also wish to disable virtualization-based security delete the following registry settings:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\EnableVirtualizationBasedSecurity
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\RequirePlatformSecurityFeatures
If you manually remove these registry settings, make sure to delete them all. If you don't remove them all, the device might go into BitLocker recovery.
Delete the Windows Defender Credential Guard EFI variables by using bcdedit. From an elevated command prompt, type the following commands:
mountvol X: /s
copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:
mountvol X: /d
- Details
- Written by: po3dno
- Category: pg
- Hits: 248
Устанавливаем PostgreSQL на Mac OS.
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 373
This post explains how to work with ODBC connections in Powershell. Powershell 4 introduced new cmdlets that make it very easy to create and manage ODBC connections. We use the .NET assembly system.data.odbc.odbcconnection to use ODBC connections present on the system to query the database.
ODBC connections in Powershell 4.0 and higher
Powershell 4 introduced these 4 cmdlets to create, manage and remove ODBC connections. If you for some reason still are on Powershell 3.0, I recommend you to upgrade to Powershell 5.0 which is the newest version at the time of this blog post. Managing ODBC connections in Powershell 3 or older is not fun and requires you to either modify registry or use an .exe file to manage them for you.
- Add-OdbcDsn
- Get-OdbcDsn
- Remove-OdbcDsn
- Set-OdbcDsn