FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!

Marcuzzo's Blog

Created on Tue Apr 26, 2011 5:50 am with 20 blog posts
Welcome to my blog

Arch linux in Moving to Linux with 6 comments on Sat Jun 10, 2017 3:13 am
I've installed and used Debian and lately ubuntu on my home server for a while now, I'm managing my synology nas mostly via ssh ( the web interface is a new experience every time I load it up in my browser ) ( yes I keep it updated ) and I've been running ' a' linux distro on my personal laptop for about a year now.

Last year I installed fedora ( first 24 and then updated to 25 ) and I like it ( I'm a gnome guy ) but the thing is, I don't llike the names these guys are using, Yes I'm aware that Fedora is sponsored by RedHat and that it's a cmmunity bla bla, still... every time I think of the word fedora I see a picture of a blue fish and the title says 'finding fedory'.
fedory says yum... hmmm I can picture the shark saying that he didn't eat fish the last 65 days ( with an english accent )
oh sorry, I forgot... it's dnf now... Jenny: 'hey what's wrong with your yum ( read 'legs')', Forrest:' Nothin's wrong with my yum, they've just been dandyfied...

I know it's a very good OS and as far as packages, updates and stability goes it's a very respectable OS and don't get me wrong, this distro is ranking at the top for me. the only issue I have with it is that the name just doesn't ring my bells ( I just don't want to use the word 'cool', ) ... ( cr*p I just did d'oh! )

so here I am, I've got a nice ( 2011) laptop sporting fedora 25, intel i7, 8GiB of Ram, 750GB HDD, NVIDIA GeForce GT 630M, aaargh who am I kidding, this is an asus K75VM which I bought back in 2011 for my evening school and is a piece of sh*t dinosour by now...
anyway, his post is about arch linux.


ARCH.... OMG have I been waiting for this distro all my life or what!
I've had some experience with debian and it's derivatives, I've also had some experience with fedora and CentOS which is the community edition of RedHat and all of these distro's are easy to install ( I prefer the debian installer over the one used by Fedora and CentOS )

what bothers me is that none of these distro's actually teach you anything about how the internals of a linux, or as Stallman calls it 'GNU/Linux", machine work.

to get a better understanding of about how a linux computer spins it's gears I had completd the LFS book, this was little over 2 years ago and it has helped me a lot. it boils down to this. you create a tool set that you need to build the kernel and packages and then you chroot into the environment, build other stuff and then you create a bootable image which loads nothing but the bare essentials. there's no package management, no updates, nada... with LFS you're on your own, heck, with LFS you didn't even create your own distro, you created a distro known to the rest of the world as 'linux from scratch"

arch reminded me a lot of LFS... you download an iso, burn that iso to a flash drive and boot into a live OS.
ALL installation steps are manually executed on the shell, I'm talking settings, partitions, swap, etc... and you end up with a textual linux distro that doesn't even have a window manager or desktop environment.

The package repository may not be one of the larger ones but there's plenty of software, and if you can't find it there I'm sure you can find it in the aur, and if not there... you compile... love it..

documentation... this was one of the key factors in getting me to install arch... all the the documentation you need can be foundi t's wiki... Im in love

Code:
[marco@asusarch ~]$ alsi

                  ##         OS: Arch Linux x86_64
                 ####         Hostname: asusarch
                ######         Uptime: 1:05, 52 sec
               ########         Kernel: 4.11.3-1-ARCH
              ##########      Shell: /bin/bash
             ############      Packages: 881
            ##############      Window Manager: Unknown
           ################      RAM: 1674M / 7678M (21%)
          ##################      SWAP: 0M / 14335M (0%)
         ####################      CPU: Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz
        ######################      Boot: 34M / 1022M (4%) (vfat)
       #########      #########      Home: 393M / 653G (1%) (ext4)
      ##########      ##########   Root: 6,0G / 20G (32%) (ext4)
     ###########      ###########   
    ##########          ##########   
   #######                  #######   
  ####                          ####   
 ###                              ###   

[marco@asusarch ~]$



If you're new to linux... most people will say 'try ubuntu' and in a way they're right... Arch is not a beginner distro.
But then again, some please say that ASM and C are the best language to start with when you want to learn how to program... so if you want to get your feet wet and have got a lot of patience, get to it... https://wiki.archlinux.org/index.php/installation_guide
Powershell - Lockoutstatus in code-n-stuff with 0 comments on Wed May 24, 2017 10:41 pm
This is basically a powershell implementation of LockoutStatus

I've written this a while ago and it's a quick and dirty script that I needed to coock up fast.
this could be improved by using the pipeline and the ADUser object as input but it get's the job done.

Code:
function Get-LockoutStatus{
<#
.Synopsis
   Gets a user's lockout status from all domain controllers
.DESCRIPTION
   Gets a user's lockout status from all domain controllers
.PARAMETER UserName
The username to check
.EXAMPLE   
Get-Lockoutstatus -UserName testuser
Gets the lockout status for the user 'testuser' from all Domain Controllers.

.NOTES
author: Marcuzzo
#>

    [CmdletBinding()]
    param(
        [Parameter( Mandatory = $true )]
        [string] $UserName
    )

    begin
    {   
        Add-Type -AssemblyName "System.DirectoryServices.AccountManagement"
        [System.DirectoryServices.ActiveDirectory.Domain] $ADDomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    }

    process
    {
       
       foreach( $DomainController in $ADDomain.DomainControllers )
       {
       
        [System.DirectoryServices.AccountManagement.PrincipalContext] $PrincipalContext = New-Object `
            -TypeName System.DirectoryServices.AccountManagement.PrincipalContext `
            -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Domain), $DomainController.Name

        [System.DirectoryServices.AccountManagement.UserPrincipal] $UserPrincipal = New-Object `
            -TypeName System.DirectoryServices.AccountManagement.UserPrincipal `
            -ArgumentList $PrincipalContext

        $UserPrincipal.SamAccountName = $UserName

        [System.DirectoryServices.AccountManagement.PrincipalSearcher] $PrincipalSearcher = New-Object `
            -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher($UserPrincipal)

        $SearchResult = $PrincipalSearcher.FindAll()

        foreach( $principal in $SearchResult )
        {
                   
            $object = New-Object –TypeName PSObject
            $object | Add-Member –MemberType NoteProperty –Name DomainController –Value $DomainController.Name
            $object | Add-Member –MemberType NoteProperty –Name Site –Value $DomainController.SiteName
            $object | Add-Member –MemberType NoteProperty –Name IsLockedOut –Value $principal.IsAccountLockedOut()
            $object | Add-Member –MemberType NoteProperty –Name LastBadPasswordAttempt –Value $principal.LastBadPasswordAttempt
            $object | Add-Member –MemberType NoteProperty –Name LastPasswordSet –Value $principal.LastPasswordSet
            $object | Add-Member –MemberType NoteProperty –Name AccountLockoutTime –Value $principal.AccountLockoutTime
            $object | Add-Member –MemberType NoteProperty –Name BadPwdCount –Value $principal.BadLogonCount

            Write-Output $object   
           
        }

        $PrincipalSearcher.Dispose()
        $UserPrincipal.Dispose()
        $PrincipalContext.Dispose()

       }
   
    }

    end
    {
        $ADDomain.Dispose()
    }
   
}




Hope this will be usefull to anybody
Powershell - Getting computer uptime in Code Sharing with 2 comments on Thu Oct 13, 2016 5:18 pm
This function will fetch the uptime of one or more computers.
sometimes it helps to know how long ago a remote computer was last rebooted.

Code:
<#
.Synopsis
   Get computer uptime info
.DESCRIPTION
   Get uptime info from the local or remote computers
.EXAMPLE   
   Get-ComputerUptime
   Get the uptime of the local computer
.EXAMPLE
   Get-ComputerUptime -ComputerName 'Lab01'
   Gets the uptime of a computer named Lab01
.EXAMPLE
   Get-ComputerUptime -ComputerName 'Lab01', 'Lab02'
   Gets the uptime of a computer named Lab01 and Lab02
.NOTES
   author: Marcuzzo
#>
function Get-ComputerUptime {

    [CmdLetBinding()]
    param(
        [Parameter( Mandatory = $false )]
        [string[]] $ComputerName = $env:COMPUTERNAME
    )

    Begin{
    }

    Process{
   
        foreach ( $Computer in $ComputerName) {
   
            if ( Test-Connection -ComputerName $Computer -Count 1 ){

                $vInstance = Get-CimInstance -ComputerName $Computer -ClassName Win32_OperatingSystem -Namespace 'Root\CIMV2' -Property LastBootUpTime
                   
                [System.DateTime] $LastBootUpDateTime = $vInstance.LastBootUpTime

                [System.TimeSpan] $timeSpan = [System.DateTime]::Now.Subtract($LastBootUpDateTime)

                [string] $uptime = [string]::Format("{0}d {1}h {2}m {3}s", $timeSpan.Days, $timeSpan.Hours, $timeSpan.Minutes, $timeSpan.Seconds);

                $UptimeInfo = @{
                'ComputerName' = $Computer;
                'LastBootUpTime' = $LastBootUpDateTime;
                'uptime' = $uptime
                }

                Write-Output (New-Object –Typename PSObject –Prop $UptimeInfo)

            }
            else{           
                Write-Error -Message ('The computer: "{0}" is OFFLINE!' -f $Computer)
            }
       
         }

    }
}
Sharing Code - Information in Code Sharing with 0 comments on Thu Oct 13, 2016 4:12 pm
I'm giving away some of my snippets/
I've used most of these for a while and decided to share them to my fellow frihosters.

I'm mainly posting these to generate some topics and hopefully a few constructive discussions about topics that really interest me.

I'm posting these snippets under the ISC license

which states:
Quote:
Copyright (c) 2008-2016, Marcuzzo

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Powershell - connecting to a ConfigMgr Site in Code Sharing with 0 comments on Thu Oct 13, 2016 4:02 pm
This basically does the same as clicking on 'file' in the configMgr admin console.

a lot of times I need to fetch data from the SCCM server and other locations such as Active Directory or a file server.



Code:
<#
   
    Author: Marcuzzo
    Description: Run this script on a server that has the configuration manager
                 console installed.
                 this script will load the CMDLets and will set the location to
                 the site.
                 for more information on the available CmdLets...
                 see: https://technet.microsoft.com/en-us/library/jj821831.aspx
                 
    Date: 13/05/2015
    Usage: powershell -NoExit -File Connect-CMSite.ps1

#>

# Check the environment variable set by the configuration manager console
if ( $Env:SMS_ADMIN_UI_PATH -eq $null )
{
    throw "Env not found"
    exit
}
else
{
    #import the ConfigMgr Module
    ipmo -Name "$(split-path $Env:SMS_ADMIN_UI_PATH)\ConfigurationManager.psd1"
}

# try to get the site name
$Site = ( gdr -PSProvider CMSite -ErrorAction SilentlyContinue );

# make sure that the site is valid
if ( ! ( $site ))
{
    Throw "CMSite provider not found"   
}


# Write-Host "Connecting to: $Site"
Set-Location "$($Site.Name):"

$CMSite =  ( Get-CMSite ).SiteName
Write-Verbose -Message "`n`tWelcome to $CMSite `n"



Adding this code in my script will allow me to connect to the site and use the ConfigMgr CmdLets
--> All blog posts (20)

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.