This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Path "PATH" -recurse | Select-String -pattern "WORD" | group path | select name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.SnapIn | |
((Get-Queue).MessageCount | Measure-Object -Sum).Sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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" | |
################# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])+';') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
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) |
NewerOlder