working on it ...

Filters

Explore Public Snippets

Sort by

Found 178 snippets matching: "windows system"

    public by p.kontalis  3283  1  5  0

    Retrieve System Characteristics

    Windows System Information Function
    Public Function RetrievePCInfo() As DataTable
        Dim DT As New DataTable
        DT.Columns.Add("Class")
        DT.Columns.Add("Name")
        DT.Columns.Add("Value")
        Dim search3 As New ManagementObjectSearcher("SELECT * FROM meta_class")
        Dim info3 As New ManagementObject
        For Each info3 In search3.Get
            Dim search4 As New ManagementObjectSearcher("SELECT * FROM " & info3("__CLASS").ToString)
            Dim Squerysearch4 As String = search4.Query.QueryString.ToString
            Dim info4 As New ManagementObject
            For Each info4 In search4.Get
                For Each Prop As PropertyData In info4.Properties
                    DT.Rows.Add(info3("__CLASS").ToString, Prop.Name, Prop.Value)
                Next
            Next
        Next
        Return DT
    End Function
    
    ' Beware this of code requires a large amount of RAM.
    ' Recommended to Extract all classes first and then for each class retieve the values.
    ' info class from motherboard is Win32_Bios
    ' info class from CPU is Win32_Prosessor

    external by rilut  125  0  2  0

    C:\Windows\System32\drivers\etc\hosts

    C:\Windows\System32\drivers\etc\hosts: hosts
    198.41.208.137 reddit.com
    198.41.208.137 www.reddit.com
    198.41.208.137 np.reddit.com
    23.235.47.193 imgur.com
    23.235.47.193 www.imgur.com
    199.27.79.193 i.imgur.com
    104.156.81.217 vimeo.com
    74.113.233.133 player.vimeo.com
    104.28.4.42 thepiratebay.se
    
    
    

    external by ctrlbold  497  8  3  0

    PowerShell function Get-SystemColor to get GUI list of System.Windows.SystemColors

    PowerShell function Get-SystemColor to get GUI list of System.Windows.SystemColors: Get-SystemColors.ps1
    Function Get-SystemColors {
    	[xml]$script:xaml = '
    	<Window 
    			xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    			xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    			Title="System Colors" Height="500" Width="375">
    	<Grid>
    	<DataGrid Name="datagrid" AutoGenerateColumns="False" GridLinesVisibility="Vertical">
    		<DataGrid.Columns>
    			<DataGridTemplateColumn Header="Color" Width="100">
    				<DataGridTemplateColumn.CellTemplate>
    					<DataTemplate>
    						<TextBlock Margin="5">
    							<TextBlock.Background>
    								<SolidColorBrush Color="{Binding Color}" />
    							</TextBlock.Background>
    						</TextBlock>
    					</DataTemplate>
    				</DataGridTemplateColumn.CellTemplate>
    			</DataGridTemplateColumn>
    			<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="Auto"/>
    			<DataGridTextColumn Header="Hex" Binding="{Binding Hex}" Width="Auto"/>
    		</DataGrid.Columns>
    	</DataGrid>
    	</Grid>
    	</Window>'
    
    	try { Add-Type -AssemblyName PresentationCore,PresentationFramework,WindowsBase,System.Windows.Forms,PresentationFramework.Luna } 
    	catch { throw "Failed to load Windows Presentation Framework assemblies." }
    
    	$script:form = [Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xaml))
    	$xaml.SelectNodes("//*[@Name]") | ForEach-Object { Set-Variable -Name ($_.Name) -Value $form.FindName($_.Name) -Scope Script }
    
    	$properties = [System.Windows.SystemColors].GetProperties()
    	$colorlist = $properties | Where-Object { $_.PropertyType.Name -eq "Color" }
    
    	$colorcollection = @()
    
    	foreach ($color in $colorlist.name) {
    		$colorgrid = {} | Select Color, Name, Hex
    		$systemcolor = [System.Windows.SystemColors]::$color
    		$colorgrid.Color = $systemcolor
    		$colorgrid.Name = $color
    		$colorgrid.Hex = $systemcolor
    		$colorcollection += $colorgrid
    	}
    
    	$datagrid.ItemsSource = @($colorcollection)
    	  
    	$form.ShowDialog() | Out-Null
    }
    
    
    
    
    

    external by jamescoxhead  726  1  3  0

    IIS URL Compression for SVG and fonts (under C:\Windows\System32\inetsrv\config)

    IIS URL Compression for SVG and fonts (under C:\Windows\System32\inetsrv\config): applicationHost.config.xml
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
            <staticTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="application/atom+xml" enabled="true" />
                <add mimeType="application/xaml+xml" enabled="true" />
                <add mimeType="*/*" enabled="false" />
    
                <!-- HERE -->
                <add mimeType="image/svg+xml" enabled="true" />
                <add mimeType="application/x-font-ttf" enabled="true" />
                <add mimeType="application/octet-stream" enabled="true" />
                <!-- HERE -->
    
            </staticTypes>
            <dynamicTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="*/*" enabled="false" />
    
                <!-- HERE -->
                <add mimeType="image/svg+xml" enabled="true" />
                <add mimeType="application/x-font-ttf" enabled="true" />
                <add mimeType="application/octet-stream" enabled="true" />
                <!-- HERE -->
    
            </dynamicTypes>
    </httpCompression>
    
    

    external by graham192  221  0  3  0

    Autostart VMs - Make sure PfSense is running before launching anything else, then launch Plex and others if need be. Put files - C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup and C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown (repla...

    Autostart VMs - Make sure PfSense is running before launching anything else, then launch Plex and others if need be. Put files - C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup and C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown (replace start with stop or suspend): vm_start.bat
    @setlocal enableextensions enabledelayedexpansion
    @echo off
    set vmware_path="C:\Program Files (x86)\VMware\VMware Workstation"
    set vms_path=C:\Users\MY_USERNAME_HERE\Documents\Virtual Machines
    set ip_of_pfsense="PFSENSE_IP_HERE"
    
    echo Starting VMS
    echo ============
    
    echo - PFSense
    <nul set /p = "- Waiting to boot "
    %vmware_path%\vmrun start "%vms_path%\pfsense\PfSense.vmx" nogui
    
    :loop
    set state=down
    
    ping -n 1 %ip_of_pfsense% | find "TTL" > nul
    
    if not errorlevel 1 set state=up
    
    if %state%==down (
        timeout 1 /nobreak > nul
        <nul set /p =.
        goto :loop
    )
    
    echo ... Booted
    
    echo - Plex
    %vmware_path%\vmrun start "%vms_path%\plex\Plex.vmx" nogui
    
    endlocal
    
    

    external by Tim  173  0  2  0

    Delete IIS logs older than a set number of days. Can be run as a scheduled task by running action - c:\windows\system32\cscript.exe [scriptlocation]\DeleteIISLogs.vbs

    Delete IIS logs older than a set number of days. Can be run as a scheduled task by running action - c:\windows\system32\cscript.exe [scriptlocation]\DeleteIISLogs.vbs: DeleteIISLogs.vbs
    sLogFolder = "c:\inetpub\logs\LogFiles"
    iMaxAge = 7   'in days
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    set colFolder = objFSO.GetFolder(sLogFolder)
    For Each colSubfolder in colFolder.SubFolders
            Set objFolder = objFSO.GetFolder(colSubfolder.Path)
            Set colFiles = objFolder.Files
            For Each objFile in colFiles
                    iFileAge = now-objFile.DateCreated
                    if iFileAge > (iMaxAge+1)  then
                            objFSO.deletefile objFile, True
                    end if
            Next
    Next
    
    

    external by Wesley-Lomax  151  0  2  0

    Static and Dynamic compression for IIS - C:\Windows\System32\inetsrv\Config\applicationHost.config

    Static and Dynamic compression for IIS - C:\Windows\System32\inetsrv\Config\applicationHost.config: IISCompression.xml
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"
    	staticCompressionDisableCpuUsage="95" staticCompressionEnableCpuUsage="60"
    	dynamicCompressionDisableCpuUsage="95" dynamicCompressionEnableCpuUsage="50">
    	<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
    	<dynamicTypes>
    	  <add mimeType="text/*" enabled="true" />
    	  <add mimeType="message/*" enabled="true" />
    	  <add mimeType="application/x-javascript" enabled="true" />
    	  <add mimeType="application/javascript" enabled="true" />
    	  <add mimeType="application/javascript; charset=utf-8" enabled="true" />
    	  <add mimeType="*/*" enabled="false" />
    	  <add mimeType="application/json" enabled="true" />
    	  <add mimeType="application/json; charset=utf-8" enabled="true" />
    	</dynamicTypes>
    	<staticTypes>
    	  <add mimeType="text/*" enabled="true" />
    	  <add mimeType="message/*" enabled="true" />
    	  <add mimeType="application/x-javascript" enabled="true" />
    	  <add mimeType="application/javascript" enabled="true" />
    	  <add mimeType="application/javascript; charset=utf-8" enabled="true" />
    	  <add mimeType="application/atom+xml" enabled="true" />
    	  <add mimeType="application/xaml+xml" enabled="true" />
    	  <add mimeType="application/json" enabled="true" />
    	  <add mimeType="application/json; charset=utf-8" enabled="true" />
    	  <add mimeType="*/*" enabled="false" />
    	</staticTypes>
      </httpCompression>
    
    
    

    external by Bartosz V. Bentkowski  150  0  2  0

    PWD command for Windows - just copy this to wherever you have PATH available (e.g. C:\Windows\System32)

    PWD command for Windows - just copy this to wherever you have PATH available (e.g. C:\Windows\System32): pwd.cmd
    @echo %cd%
    
    

    external by XSS.Cx  127  0  2  0

    findstr /C:"sc{r}" \WINDOWS\SYSTEM32\mshtml.dll|find "{"

    findstr /C:"sc{r}" \WINDOWS\SYSTEM32\mshtml.dll|find "{": findstr.txt
    ======================================================
    Extract XSS Filters from MSHTML.DLL used in IE9
    ======================================================
    findstr /C:"sc{r}" \WINDOWS\SYSTEM32\mshtml.dll|find "{"
    ======================================================
    IE9 Summary - 23 Hardcoded Regex in mshtml.dll
    ======================================================
    Fixed strings (2) javascript:, vbscript:
    HTML tags (14) object, applet, base, link, meta, import, embed, vmlframe, iframe, script(2), style, isindex, form
    HTML attributes (3)  " datasrc, " style=, " on*= (event handlers)
    JavaScript strings (4) ";location=, ";a.b=, ");a(, ";a(b)
    ======================================================
    XSS URL Overview - IE9 XSS Filter Neutering Example - Craft a URL
    ======================================================
    HTTP GET http://victim.fqdn/?xss=<script>
    ======================================================
    IE9 performs Regex Match the HTTP Request
    ======================================================
    {sc{r}ipt.*?>}
    ======================================================
    HTTP Response with Script Tags
    ======================================================
    <script>
    ======================================================
    IE9 will Neuter the Output
    ======================================================
    <sc#ipt>
    ======================================================
    XSS.Cx Comments on IE9 Neutering
    ======================================================
    IE9 Blocks JS by neutering:
    =
    (
    )
    
    
    

    external by ilsur  121  0  2  0

    Custom ps1 conf file. Put into "C:\Windows\System32\WindowsPowerShell\v1.0" folder.

    Custom ps1 conf file. Put into "C:\Windows\System32\WindowsPowerShell\v1.0" folder.: profile.ps1
    $shell = $Host.UI.RawUI
    
    $shell.BackgroundColor = "Black"
    $shell.ForegroundColor = "Green"
    $shell.WindowTitle = "[Custom PowerShell] " + (Get-Date).tostring()
    
    Set-alias new_command old_command
    
    Clear-Host
    
    
    • Public Snippets
    • Channels Snippets