Skip to content

Instantly share code, notes, and snippets.

@Santaro255
Santaro255 / pssession-cyrilic.ps1
Created July 8, 2021 07:45
Cyrilic letters with chcp 866
Add-Type -Namespace Win32 -Name Kernel32 -MemberDefinition @'
[DllImport("Kernel32.dll", SetLastError=true)]
public static extern bool AllocConsole();
'@
[void][Win32.Kernel32]::AllocConsole()
[Console]::OutputEncoding = [Text.Encoding]::GetEncoding(866)
Get-ChildItem -Path "PATH" -recurse | Select-String -pattern "WORD" | group path | select name
Install-WindowsFeature -Name Web-Mgmt-Service
iisreset -noforce
Set-ItemProperty -Path HKLM:\Software\Microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1
Set-Service -Name WMSvc -StartupType Automatic
Start-Service -Name WMSvc
New-NetFirewallRule -Name "Allow IIS Remote Management" -DisplayName "Allow IIS Remote Management" -Direction Inbound -Action Allow -Service WMSvc -Enabled True
import bpy
for step in range(1, 100+1):
bpy.context.scene.frame_set(step)
bpy.data.scenes["Scene"].render.filepath = "C:/tmp/frame_{}".format(step)
bpy.ops.render.render(write_still=True)
Add-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.SnapIn
((Get-Queue).MessageCount | Measure-Object -Sum).Sum
from pysnmp.hlapi import *
import pandas as pd
community = "public"
def get_model(ip):
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData(community, mpModel=0),
UdpTransportTarget((ip, 161)),
$os_name = (Get-WmiObject -Class Win32_OperatingSystem).CSName
$os_ver = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture
#1 - PC, 2 - DC, 3 - server
#$os_type = (Get-WmiObject -Class Win32_OperatingSystem).ProductType
### Settings ###
$agents_store = "\\srv\folder\zabbix_agents"
$zabbix_server = "IP ZABBIX Server"
$install_log="\\srv\folder\zabbix_agents\install_logs\$os_name.log"
#################
import bpy
csv_file="c:\\tmp\\out.csv"
f=open(csv_file, 'w')
for item in bpy.data.objects:
f.writelines(str(item.name)+', '
+str(item.location[0])+', '
+str(item.location[1])+', '
+str(item.location[2])+';')
##### edit #############
$computer = "localhost"
$printerName = "HP Color LaserJet CP2020 Series PCL 6"
$portName = "\\HOSTNAME\HP Color LaserJet CP2020 Series PCL6"
$driverPath = "\\HOSTNAME\Drivers\hp2025"
$inf_x86 = "hppcp610.inf"
$inf_x64 = "hppdp610.inf"
#########################
#platform
switch ($ver = (Get-WmiObject -Class win32_operatingsystem).OSArchitecture) {
<#
If you have UnknownError recreate script file with notepad.
This script must be signed first by
Set-AuthenticodeSignature -FilePath "PATH_TO_THIS_SCRIPT" -Certificate (Get-PfxCertificate "PATH_TO_CERT")
or just change ExecutionPolicy.
#>
function sign_cert($file) {
$certpath = "INSERT_PATH_TO_CERT"
$certpass = "INSERT_PASS_FOR_CERT"
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certpath, $certpass)