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
<# | |
This script convert ESD to WIM file, should run with administrative rights. | |
There is no error catcher so if you wrong in path or filename restart script with Ctrl+C or close window. | |
#> | |
$esdfile=Read-Host -Prompt "Enter ESD filename with extension(if in this folder) or path" | |
Write-Host "`nDistributive contains:" | |
Dism.exe /Get-WimInfo /WimFile:$esdfile |
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
#HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\ {20D04FE0-3AEA-1069-A2D8-08002B30309D} = 0/show , 1/hide | |
$path="HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" | |
$name="{20D04FE0-3AEA-1069-A2D8-08002B30309D}" | |
$exist="Get-ItemProperty -Path $path -Name $name" | |
if ($exist) | |
{ | |
Set-ItemProperty -Path $path -Name $name -Value 0 | |
} | |
Else | |
{ |
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 regular expression | |
import re | |
#text | |
message = "Sample text here. Some kind of message. More: complex@ !text? :message;." | |
#split text by words | |
splitmsg = re.findall('\w+',message) | |
#array of words that should be replaced | |
words = {'text':"t**t",'message':"msg"} | |
#print original text | |
print(message) |
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
#define SCCM server | |
$srvsccm = "SERVERNAME" | |
#input username | |
$username = Read-Host "Input username (at least 3 letters):" | |
#get users pc from sccm wmi namespace | |
$userpc = Get-WmiObject -ComputerName $srvsccm -Namespace "root\SMS\Site_NVK" -Class SMS_UserMachineRelationship -Filter "UniqueUserName LIKE '%$username%'" | Format-Table -Property UniqueUserName, ResourceName, IsActive -AutoSize | |
#get only pc names | |
$userpcname = (Get-WmiObject -ComputerName $srvsccm -Namespace "root\SMS\Site_NVK" -Class SMS_UserMachineRelationship -Filter "UniqueUserName LIKE '%$username%'").ResourceName | |
#get user info from AD (need RSAT or powershell AD module) | |
$userinfo = Get-ADUser -Filter "SamAccountName -like '*$username*'" -Properties DisplayName, Department, Title, Office, telephoneNumber, MobilePhone, Enabled, LastLogonDate, PasswordLastSet | select DisplayName, Department, Title, Office, telephoneNumber, MobilePhone, Enabled, LastLogonDate, PasswordLastSet |
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
#define scan account | |
$domain = "DOMAIN" | |
$name = "NAME" | |
$scandef = "DOMAIN\NAME" | |
#get username | |
$getusername = (Get-WmiObject -Class Win32_ComputerSystem).Username | |
function scanacl() { | |
#set full access for scan | |
$access=New-Object System.Security.AccessControl.FileSystemAccessRule ("$scandef","FullControl","ContainerInherit,ObjectInherit","None","Allow") | |
$ACL = Get-Acl -Path C:\Scan |
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
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms723602(v%3dvs.85) | |
txt = "test" | |
(New-Object -ComObject "SAPI.spVoice").Speak("$txt") |
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
$pcname = Read-Host "Enter PC name" | |
#function | |
function queryports() { | |
#.NET class for open remote registry | |
$registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine", "$pcname") | |
#path | |
$registryKey = "SYSTEM\CurrentControlSet\Control\Print\Monitors\HP Standard TCP/IP Port\Ports" | |
#open registry | |
$regKey = $registry.OpenSubKey($registryKey) | |
#for counter |
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
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | |
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | |
#[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.SystemParameters") | |
$bounds = [System.Windows.Forms.Screen]::PrimaryScreen | |
$w = $bounds.bounds.width#[System.Windows.SystemParameters]::VirtualScreenWidth | |
$h = $bounds.bounds.height#[System.Windows.SystemParameters]::VirtualScreenHeight | |
$img = New-Object System.Drawing.Bitmap($w, $h, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb) |
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
$q=Read-Host -Prompt "connect\disconnect" | |
switch ($q) { | |
{$q -eq "connect"} {$fqdn=Read-Host -Prompt "Enter FQDN" | |
$UserCredential = Get-Credential | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://"$fqdn"/PowerShell/ -Authentication Kerberos -Credential $UserCredential | |
Import-PSSession $Session -DisableNameChecking} | |
{$q -eq "disconnect"} {Remove-PSSession $Session} | |
} | |
OlderNewer