Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

61 total results found

Delete File

Ansible Playbook Snippets/Scripts

Delete Local - name: Delete uploaded file at ansible centralize data location file: path: "/tmp/directory/filename.extension" state: absent delegate_to: localhost Delete Remote - name: Delete uploaded file at target machine win_file: ...

Upload File to Remote Directory

Ansible Playbook Snippets/Scripts

- name: Upload program file to target machine win_copy: src: "/tmp/setup.exe" dest: "{{targetlocation}}\\" # or "C:\\temp\\  

Set Fail Msg

Ansible Playbook Snippets/Scripts

Set fail message when directory does not exist - name: Check if src directory exist in target machine win_stat: path: "{{ dirtoscan }}" register: srcdir_data - name: Skip if src directory exist fail: msg: "Directory {{dirtoscan}} do not ex...

Reboot Windows Server

Ansible Playbook Snippets/Scripts

- name: Reboot server win_reboot: connect_timeout: 1200 reboot_timeout: 600 # Gives 5min to reboot register: rebootlog ignore_errors: yes  

Function

PowerShell Snippets/Scripts

Create a function and return the value function CombineString () { [CmdletBinding()] param( [Parameter(Mandatory = $true)] $stringIn1, [Parameter(Mandatory = $true)] $stringIn2 ) $newStr = $stringIn1 + " " + $stringIn...

If-Else Statement

PowerShell Snippets/Scripts

if ($computertype -eq "64bit"){ $result = "64bit" } elseif ($computertype -eq "32bit") { $result = "32bit" } elseif ($computertype -eq "all") { $result = "all" } else { $result = "none" }  

PSObject

PowerShell Snippets/Scripts

Code: # Dummy Data $name = "John Doe" $age = 29 $gender = "Male" $desc = "Nameless Person" # Create an object with the given properties $newPSObject = New-Object -TypeName PSObject $newPSObject | Add-Member -MemberType NoteProperty -Name Name -Value ...

realmd/sssd | Joining a Domain with RHEL and logging in with AD account

RedHat

Install the necessary packages and join a domain SSSD = Authentication service from a remote source such as ADrealmd = Active Directory service Install the packages yum install sssd realmd oddjob oddjob-mkhomedir adcli samba-common samba-common-tools krb5-w...

RHEL | User, Group and Password

RedHat

User Management Add new user useradd Create a user and set the primary group to something else  sudo useradd -G consultants consultant3 Delete User userdel johndoe1 Append group to user usermod -aG sudo myusername Group Management Add new group gr...

Bitwise OR XOR AND Calculator

Python Snippets/Scripts

Example: Code: def valid_expression(expression: str) -> bool: """ Returns True if string is valid binary expression. False otherwise. - Operand is valid binary digits - Operator is either '!', '&', or '|' - Le...

RHEL | Mounting ISO and Setting as Local Repo

RedHat

Prerequisite A Free RedHat Account Official Redhat Linux ISO No Redhat license is required. Step 1: Identify the Red Hat OS version Run the following command in the terminal: cat /etc/os-release Look for the line VERSION="8.7 (Ootpa)" in the outpu...

Net User Examples

Windows System Administrator

Local User The command net user is the same as the PowerShell command Get-LocalUser. Command for cmd net user locadmin Command for PowerShell Get-LocalUser locadmin Example PS C:\Windows\system32> Get-LocalUser locadmin Name Enabled Description ...

Configuring w32time As NTP Client

Windows System Administrator NTP

Step 1: Stop the time service net stop w32time Step 2: Set the manual peer list of external servers w32tm /config /syncfromflags:manual /manualpeerlist:“[server1],0x8 [server2],0x8” Step 3: Set the connection as reliable w32tm /config /reliable:yes Step ...

Configure NTP Server in AD

Windows System Administrator NTP

Option 1 - Via GPO Setup GPO for NTP Server and apply it to the Domain Controller. Setup GPO for NTP Client for Member Server Option 2 - Manually via Regedit Enable NTP Server in Domain Controller. Change the server type to NTP. To do this, follow...

Test TCP Port

Windows System Administrator

To test TCP connection if open in the destination address PS C:\Windows\system32> tnc 10.1.1.94 -port 443 ComputerName : 10.1.1.94 RemoteAddress : 10.1.1.94 RemotePort : 443 InterfaceAlias : Ethernet Instance 0 SourceAddress : 10.1....

Sort Array Descending Order

JavaScript Snippets/Scripts

// Sort Descending Date tempArray = originalArray.slice(); tempArray.sort(function(a,b){ return new Date(b.date) - new Date(a.date); }); for (i = 0; i < tempArray.length; i++) { console.log(`\t${i + 1}) ${tempArray[i].date} - ${tempArray[i].dis...

Disable TLS 1.0 & 1.1

Windows System Administrator

Copy this and save it into a registry file (disableTLS.reg).Run the file as admin. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server] "Enabled"=dword:00000000 "Di...

Decimal to Binary Converter

Python Snippets/Scripts

Example: Code: def decToBinLongDivision(decimal: int) -> None: numtodivide = decimal quotient = 0 remainder = 0 bitlenght = 0 strBinary = "" if decimal == 0: strBinary = '0' print('Division by 2\tQuot...

Decimal to Hex Converter

Python Snippets/Scripts

Example: Code: def decToHexLongDivision(decimal: int) -> str: numtodivide = decimal quotient = 0 remainder = 0 bitlenght = 0 strBinary = "" print('\nDivision by 16\tQuotient\tRemainder\tBit #') while True: ...

2s Compliment Calculator

Python Snippets/Scripts

Example: Code: def binaryToDecimal(val: str) -> int: return int(val, 2) def decimalToBinary(n: int) -> str: return bin(n).replace("0b", "") def fillBinaryZero(binary: str, bitLenght: int) -> str: offset = bitLenght - len(binary) ...