About Me

My photo
HANUMANGARH, RAJASTHAN, India

Monday 29 August 2022

Get Folder ACL Level wise

 $rFolder = Get-Content C:\Users\su-skumar\Desktop\ser.txt

[int]$recursionDepth = Read-Host -Prompt "Enter recursion depth"

[string]$outputCsv = Read-Host -Prompt "Enter output .csv file (full path)"

[string]$recursionStr = if ($recursionDepth -eq 0) { "\*" } else { ("\*" * ($recursionDepth + 1)) }

foreach ($rootFolder in $rFolder){

$folders = Get-ChildItem -Directory -Path "$rootFolder$recursionStr" -Force | Where-Object { $_.PSIsContainer -eq $true }

[array]$report = @()


foreach ($folder in $folders) {

    $acl = Get-Acl -Path $folder.FullName

    foreach ($access in $acl.access) {

        [hashtable]$properties = [ordered]@{

            'FolderName'       = $folder.FullName;

            'AD Group or User' = $access.IdentityReference;

            'Permissions'      = $access.FileSystemRights;

            'Inherited'        = $access.IsInherited

        }

        $report += New-Object -TypeName PSObject -Property $properties

    }

}

Write-Host $report

$report | Export-Csv -Path $outputCsv -Append


}

Friday 5 August 2022

Get Local Administrators Group Members detail from Remote Host

 <#

        .Synopsis 

            Gets membership information of local groups in remote computer


        .Description

            This script by default queries the membership details of local administrators group on remote computers. 

            It has a provision to query any local group in remote server, not just administrators group.


        .Parameter ComputerName

            Computer Name(s) which you want to query for local group information


        .Parameter LocalGroupName

            Name of the local group which you want to query for membership information. It queries 'Administrators' group when

            this parameter is not specified


        .Parameter OutputDir

            Name of the folder where you want to place the output file. It creates the output file in c:\temp folder

            this parameter is not used.


        .Example

            Get-LocalGroupMembers.ps1 -ComputerName srvmem1, srvmem2


            Queries the local administrators group membership and writes the details to c:\temp\localGroupMembers.CSV


        .Example

            Get-LocalGroupMembers.ps1 -ComputerName (get-content c:\temp\servers.txt)


        .Example

            Get-LocalGroupMembers.ps1 -ComputerName srvmem1, srvmem2



#>

[CmdletBinding()]

Param(

    [Parameter(    ValueFromPipeline=$true,

                ValueFromPipelineByPropertyName=$true

                )]

    [string[]]

    $ComputerName = $env:ComputerName,


    [Parameter()]

    [string]

    $LocalGroupName = "Administrators",


    [Parameter()]

    [string]

    $OutputDir = "c:\temp"

)


Begin {


    $OutputFile = Join-Path $OutputDir "LocalGroupMembers.csv"

    Write-Verbose "Script will write the output to $OutputFile folder"

    Add-Content -Path $OutPutFile -Value "ComputerName, LocalGroupName, Status, MemberType, MemberDomain, MemberName"

}


Process {

    ForEach($Computer in $ComputerName) {

        Write-host "Working on $Computer"

        If(!(Test-Connection -ComputerName $Computer -Count 1 -Quiet)) {

            Write-Verbose "$Computer is offline. Proceeding with next computer"

            Add-Content -Path $OutputFile -Value "$Computer,$LocalGroupName,Offline"

            Continue

        } else {

            Write-Verbose "Working on $computer"

            try {

                $group = [ADSI]"WinNT://$Computer/$LocalGroupName"

                $members = @($group.Invoke("Members"))

                Write-Verbose "Successfully queries the members of $computer"

                if(!$members) {

                    Add-Content -Path $OutputFile -Value "$Computer,$LocalGroupName,NoMembersFound"

                    Write-Verbose "No members found in the group"

                    continue

                }

            }        

            catch {

                Write-Verbose "Failed to query the members of $computer"

                Add-Content -Path $OutputFile -Value "$Computer,,FailedToQuery"

                Continue

            }

            foreach($member in $members) {

                try {

                    $MemberName = $member.GetType().Invokemember("Name","GetProperty",$null,$member,$null)

                    $MemberType = $member.GetType().Invokemember("Class","GetProperty",$null,$member,$null)

                    $MemberPath = $member.GetType().Invokemember("ADSPath","GetProperty",$null,$member,$null)

                    $MemberDomain = $null

                    if($MemberPath -match "^Winnt\:\/\/(?<domainName>\S+)\/(?<CompName>\S+)\/") {

                        if($MemberType -eq "User") {

                            $MemberType = "LocalUser"

                        } elseif($MemberType -eq "Group"){

                            $MemberType = "LocalGroup"

                        }

                        $MemberDomain = $matches["CompName"]


                    } elseif($MemberPath -match "^WinNT\:\/\/(?<domainname>\S+)/") {

                        if($MemberType -eq "User") {

                            $MemberType = "DomainUser"

                        } elseif($MemberType -eq "Group"){

                            $MemberType = "DomainGroup"

                        }

                        $MemberDomain = $matches["domainname"]


                    } else {

                        $MemberType = "Unknown"

                        $MemberDomain = "Unknown"

                    }

                Add-Content -Path $OutPutFile -Value "$Computer, $LocalGroupName, SUCCESS, $MemberType, $MemberDomain, $MemberName"

                } catch {

                    Write-Verbose "failed to query details of a member. Details $_"

                    Add-Content -Path $OutputFile -Value "$Computer,,FailedQueryMember"

                }


            } 

        }


    }


}

End {}

Assessment-3

 

QUESTION:

Which term from the list below would be viewed as benefits of using cloud services?

Unpredictable Cost

Elasticity

Local Reach only

 

QUESTION:

Suppose you have two types of applications: legacy applications that require specialized mainframe hardware and newer applications that can run on commodity hardware. Which cloud deployment model would be best for you?

Public Cloud

Private Cloud

Hybrid Cloud

 

QUESTION:

What is Azure?

Microsoft's cloud computing platform, which provides compute power, storage, and services over the Internet using a pay-as-you-go pricing model.

A single data center located in Redmond, Washington.

A hosting environment specifically for virtual machines

 

QUESTION:

Which of the following is an example of an Azure compute service?

Azure Virtual Machine

Azure Load Balancer

Azure Table Storage

Azure Cache for Redis

 

QUESTION 

True or False. You can select the specific Data Center you want to deploy your app?

True

False


QUESTION 

True or False. Every Region has Availability Zone.

True

False

 

 

QUESTION:

Imagine that you work on a photo-sharing application that runs on millions of mobile devices. Demand is unpredictable because you see a spike in usage whenever a locally or nationally significant event occurs. Which Azure compute resource is the best match for this workload?

Serverless Computing

Containers

Virtual Machine

 

QUESTION:

The compute options give you different levels of control over the configuration of the environment in which your application runs. Which of the following lists the compute options in order from "most control" to "least control"?

Serverless computing, containers, virtual machines

Containers, serverless computing, virtual machines

Virtual machines, containers, serverless computing

 

QUESTION:

Suppose you work at a startup with limited funding. Why might you prefer Azure data storage over an on-premises solution?

To ensure you run on a specific brand of hardware which will let you to form a marketing partnership with that hardware vendor.

The Azure pay-as-you-go billing model lets you avoid buying expensive hardware.

To get exact control over the location of your data store.

 

 

QUESTION:

What is an Azure region?

An Azure data center within a specific geographic location.

A way of breaking networks into smaller networks

Firewall rules which define the flow of traffic in and out of Azure.

 

 

 

QUESTION:

Which of these is the strongest way to protect sensitive customer data?

Encrypt data as it sits in your database

Encrypt data as it travels over the network

Encrypt data both as it sits in your database and as it travels over the network

 

QUESTION:

There has been an attack on your public-facing website, and the application's resources have been overwhelmed and exhausted, and are now unavailable to users. What service should you use to prevent this type of attack?

DDoS protection

Azure Firewall

Network Security Group

Application Gateway

 

QUESTION:

You want to store certificates in Azure to ally manage them for your services. Which Azure service should you use?

MSIP

Azure AD

Azure Key Vault

Azure ATP

 

QUESTION:

In which tab of the Azure pricing calculator will you formulate your estimate?

Estimate

Products

 

QUESTION:

True or false: You can share your estimate through an Excel spreadsheet or through a URL.

True

False

 

QUESTION:

True or false: Azure Advisor provides recommendations on cost only.

True

False

 

QUESTION:

Azure Cost Management allows you to _________.

See historical breakdowns of what services you are spending your money on

See estimates of what your services might cost if you make a change

 

 

QUESTION:

True or false: PaaS is generally less expensive than IaaS.

True

False

 

QUESTION:

True or false: If you already have Windows Server licenses, you have to pay for them again on Azure

True

False

 

QUESTION:

True or false: Azure has money-saving options for test and development servers

True

False

 

QUESTION:

Which of the following are used to determine Azure costs for each billing period?

The Azure website

Number of created virtual machines

The Azure pricing calculator

Usage meters

 

 

QUESTION:

Complete the following sentence. As an Azure customer, Azure Reservations offer discounted prices if you _________

Pay in advance

Provision many resources

Have a free account

Use spending limits

 

QUESTION:

_________is the ability to do things more efficiently or at a lower-cost per unit when operating at a larger scale. Which AZURE service would simplify migration of a database to AZURE?

Economies of Scale

Scale of Economies

 

QUESTION:

Which of the following service is a part of Compute Services?

Azure Virtual Machine

Azure Virtual Network

Azure Firewall

 

QUESTION:

Which of the following storage service is used to store very large objects?

Azure File Storage

Azure Table Storage

Azure Blob Storage

 

 

 

QUESTION:

Which one service out of the following services not part of Azure Networking Service?

Azure Virtual Network

Azure Load Balancer

Azure DNS

Azure Service Fabric

 

QUESTION:

Which following service is formerly known as Visual Studio Team Service (VSTS)?

Azure DevOps

Azure Dev Test Labs

 

 

QUESTION:

what is the definition of Region in Azure?

A region is a geographical area on the planet containing at least one, but potentially multiple datacentres that are nearby and networked together with a low-latency network

A region is a location distant apart with a single datacentre and networked together with high-latency network.

 

QUESTION:

Your Development team is planning to host a development environment on the cloud. This consists of on VM. This environment will probably be required for 2 months. types of instances would you use for this purpose?

On-Demand

Reserved

Dedicated Hosts

 

QUESTION:

what is the definition of Zone?

A Zone is a geographical grouping of Azure Regions for billing purposes

A Zone is a location that consists of multiple data centres.

 

QUESTION:

What is Azure Active Directory (Azure AD)?

Azure AD is a cloud-based identity service.

Azure AD is a cloud-based Authentication service

Azure AD is a cloud-based Authorization service

 

QUESTION:

Which of the following service allows you to distribute load across multiple VM’s?

Azure Autoscaling

Azure Load Balancer

Azure Virtual Network

 

QUESTION:

You have a requirement to host an application on a VM that will be used for a minimum for a year. which of the following would be the most-cost effective option?

On-Demand Instance

Reserved Instance

Dedicated Host

 

 

QUESTION:

What is an Availability Zone?

Availability Zones are physically separate datacentres within an Azure region.

Availability Zones are physically separate data centres in a location.

 

 


Assessment-2

 A type of malware that encrypts documents, pictures, and other files, making them unreadable and the attacker then holds the decryption key for ransom until you agree to pay money is known as ___?

Phishing

Ransomware CORRECT

Social Engineering

None of the above

 

 What is ransomware based on?

Fear of Attack

Fear of the internet

Fear of Antivirus

Fear of losing an important file CORRECT

 

What process does a ransomware hacker perform on a user's system?

Encrypting important files CORRECT

Moving operating system data

Deleting a key system data

Coping a user’s personal data

 

What are the different kinds of Ransomware?

Locker Ransomware

Mobile Ransomware

Crypto Ransomware

All of above CORRECT

Thursday 4 August 2022

Update Single Registry Value through Powershell

 $server = Get-Content C:\Users\sunil\Desktop\Book1.xlsx


foreach($ser in $server){


Set-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\Lsa –Name RestrictRemoteSAM -Value 'O:BAG:BAD:(A;;RC;;;LA)'


#Get-ItemProperty –Path HKLM:\System\CurrentControlSet\Control\Lsa –Name RestrictRemoteSAM


}

Check RDP port in remote host

 $ser = Get-Content C:\Users\su-skumar\Desktop\servers.txt

 

ForEach ($one in $ser){

    Test-NetConnection -ComputerName $one -CommonTCPPort RDP | 

    Select-Object -Property ComputerName, RemotePort, PingSucceeded, TcpTestSucceeded | 

    Out-File -FilePath 'C:\Temp\TNCResults.txt' -Append

}  

Get-Content -Path 'C:\Temp\TNCResults.txt'

Export contact from Justdial

  Extract Data From JustDial using Selenium Let us see how to extract data from Justdial using Selenium and Python. Justdial is a company th...