IT Questions and Answers :)

Sunday, August 25, 2019

Which of the following folder names can NOT be used with Windows?

Which of the following folder names can NOT be used with Windows?

  • MAK
  • CON
  • CAN
  • SUB 
 Which of the following folder names can NOT be used with Windows?


EXPLANATION

You can’t create folders in Windows OS having CON, PRN, NUL, etc. as the name. This is because these folder names are reserved for use in specific system tasks. You can use the command prompt, or blank space code to create folders with reserved names in Windows. In Microsoft Windows operating system, you can’t create folders that have their name from one of these words:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.
Also, you can’t add file extensions with these names. For instance, you can’t create NUL.mp3 folder.
The reason is these keywords are reserved for some tasks to be performed by the OS. It uses these words to create folders from time to time and store data in them for tasks related to printing and other functions. We creating a folder with the same name would confuse the system.
The history of these reserved Windows folder names dates back to the time when Microsoft was known for its DOS operating system. Since then, no change has been made to these names. You might’ve read a similar story on Fossbytes, why the first drive letter is C?

You can still create CON, PRN folders

Although it’s hard to name a Windows folder as CON or PRN directly, a workaround is possible. Before proceeding further, I would like to tell you that Windows also doesn’t allow a folder name only comprising of a blank space.
You can create a folder without a name or one of the reserved names using a key combination.
  1. Create a new folder, or click the rename option for an existing folder.
  2. Delete all the text written in the name field.
  3. Press and hold the ALT key and type 255 on the “Numpad”. As you enter the key combination, you won’t see anything typed in the name field.
  4. After this, type the desired name and press Enter. Or don’t enter any name to create a Windows folder without a name.
The key combination ALT+255 is a code used to introduce a blank space in Windows. You are just adding an extra invisible character to create a folder name CON or PRN.

Create CON, PRN folders using the command line?

For most Windows users, command prompt or CMD is probably the last mile solution for a problem. But it’s effective. You can use the command prompt in Windows to create folders with reserved names.

  1. To open CMD, right on the Start button and click Command Prompt.
  2. Now type the following command to create a folder name CON on the desktop (Copy the path to your desktop):
    md C:\Users\techlanda\Desktop\con\
  3. Press Enter. You can create other reserved Windows folder using CMD. Also, you can change the location where want to create the folder.
  4. Delete the CON folder:
    rd C:\Users\techlanda\Desktop\con\
Although we can create the folder successfully, it is still inaccessible. Also, it can only be deleted using the command line. I would recommend not to use the command-line method.



Share:

To be part of a VTP domain, what must all switches have configured?

To be part of a VTP domain, what must all switches have configured?

  • IP address in the management VLAN
  • VTP MD5 authentication
  • Same VTP Version
  • Switchports in host mode for all connecting ports

To be part of a VTP domain, what must all switches have configured?

EXPLANATION

VTP Configuration Guidelines

This section provides some guidelines for the configuration of VTP in the network.
  • All switches have the same the VTP domain name, unless the network design insists for different VTP domains.
    Note: Trunk negotiation does not work across VTP domains. Refer to the Data Traffic Blocked between VTP Domains section of Troubleshooting VLAN Trunk Protocol (VTP) for more information.
  • All switches in a VTP domain must run the same VTP version.
  • All switches in a VTP domain has the same VTP password, if there is any.
  • All VTP Server switch(es) should have the same configuration revision number and it should also be the highest in the domain.
  • When you move a VTP mode of a switch from Transparent to Server, VLANs configured on the VTP Transparent switch should exist on the Server switch.


Share:

By default, what command-line text editor does Raspberry Pi use?

By default, what command-line text editor does Raspberry Pi use?

  • vi
  • nano
  • vim
  • editit 
By default, what command-line text editor does Raspberry Pi use?


EXPLANATION


Text editors

On Linux, you have a choice of text editors. Some are easy-to-use but have limited functionality; others require training to use and take a long time to master, but offer incredible functionality.

Desktop graphical editors

Leafpad

On Raspbian, you'll find an editor called Leafpad. This is a simple editor which opens in a window like a normal application. It allows use of the mouse and keyboard, and has tabs and syntax highlighting.
You can use keyboard shortcuts, such as Ctrl + S to save a file and Ctrl + X to exit.

Thonny

Thonny is a Python REPL and IDE, so you can write and edit Python code in a window and run it from there.
Thonny has independent windows and syntax highlighting, and uses Python 3

GVim

See Vim below.

Geany

A fast and lightweight IDE, supporting many different file types, including C/C++ and Python. Installed by default on Raspbian.

Command-line editors

Nano

GNU Nano is at the easy-to-use end of command-line editors. It's installed by default, so use nano somefile.txt to edit a file, and keyboard shortcuts like Ctrl + O to save and Ctrl + X to exit.

Vi

Vi is a very old (c. 1976) command-line editor, which is available on most UNIX systems and is pre-installed on Raspbian. It's succeeded by Vim (Vi Improved), which requires installation.
Unlike most editors, Vi and Vim have a number of different modes. When you open Vi with vi somefile.txt, you start in command mode which doesn't directly permit text entry. Press i to switch to insert mode in order to edit the file, and type away. To save the file you must return to command mode, so press the Escape key and enter :w (followed by Enter), which is the command to write the file to disk.
To search for the word 'raspberry' in a file, make sure you're in command mode (press Escape), then type /raspberry followed by n and N to flick forwards/backwards through the results.
To save and exit, enter the command :wq. To exit without saving, enter the command :q!.
Depending on your keyboard configuration, you may find your cursor keys don't work. In this case, you can use the H-J-K-L keys (which move left, down, up, and right respectively) to navigate the file in command mode.

Vim

Vim is an extension of Vi and works in much the same way, with a number of improvements. Only Vi is installed by default so to get the full features of Vim, install it with APT:
sudo apt-get install vim
You can edit a file in Vim with vim somefile.txt. Vim also has a graphical version which opens in a window and allows interaction with the mouse. This version is installable separately:
sudo apt-get install vim-gnome
To use the graphical version of Vim, use gvim somefile.txt. You can save configuration in a .vimrc file in your user's home directory. To learn more about editing in Vi and Vim, you can run vimtutor and follow the tutorial.

Emacs

Emacs is a GNU command-line text editor; it's powerful, extensible, and customisable. You can install it with APT:
sudo apt-get install emacs
You can use keyboard combination commands, such as Ctrl + X Ctrl + S to save and Ctrl + X Ctrl + C to close.

 

Share:

Which of the following do you need to take care of when you adopt a cloud solution?

Which of the following do you need to take care of when you adopt a cloud solution?

  • Network router configuring
  • Writing script to automate VM deployment
  • Security auditing
  • Performance monitoring 
Which of the following do you need to take care of when you adopt a cloud solution?

EXPLANATION

IT security audits determine whether an information system and its maintainers meet both the legal expectations of customer data protection and the company’s standards of achieving financial success against various security threats. These goals are still relevant in the emerging cloud computing model of business, but they require customization.

Cloud computing, as defined by the National Institute of Standards and Technology (NIST), is “a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.” 1 In essence, cloud computing could be described as the use of computing resources—both hardware and soft ware—provided over a network, requiring minimal interaction between users and providers.

Three service models are commonly implemented in the cloud: soft ware as a service (SaaS), platform as a service (PaaS), and infrastructure as a service (IaaS). In each of these service types, security is a signifi cant challenge. Security audits provide a clear and recognizable trail of resource access for various organizations.

Traditional IT audits typically fall into two main categories: internal and external. Internal audits refer to work done by an organization’s own employees, concern very specific organizational processes, and focus primarily on optimization and risk management. External audits give an outside perspective on an organization’s ability to meet the requirements of various laws and regulations. Organizations have used traditional IT audits to evaluate issues such as availability to authorized users and integrity and confidentiality in data storage and transmission.
But what happens when an organization’s IT resources are moved to the cloud? Because cloud computing allows for multiple users across a large domain, it exposes novel security issues such as cloud-specifi c confi dentiality concerns. These threats pose new challenges for security auditing, but cloud advocates are responding to them. For instance, groups such as Cloud Security Alliance (CSA) are urging standardization of cloud confi dentiality, integrity, and availability auditing.


 



Share:

Which statement about private clouds is true?

Which statement about private clouds is true?

  • They are more secure than public clouds
  • They are exclusively for a single organization
  • SLAs are not required
  • They do not use server virtualization 
Which statement about private clouds is true?

EXPLANATION

Private cloud refers to a model of cloud computing where IT services are provisioned over private IT infrastructure for the dedicated use of a single organization. A private cloud is usually managed via internal resources.
The terms private cloud and virtual private cloud (VPC) are often used interchangeably. Technically speaking, a VPC is a private cloud using a third-party cloud provider's infrastructure, while a private cloud is implemented over internal infrastructure.
Private clouds may also be referred to as enterprise clouds.

There is some controversy around the very idea of a private cloud. The central idea of cloud computing is an organization should not need to build out and manage computing infrastructure itself. By utilizing cloud vendors, an organization should lower costs while receiving services and applications that are on par or better than what could be done in-house. Given this, a private cloud would seem to be going backwards. An organization would still need to build out and manage the private cloud infrastructure and not get any benefits from the economies of scale that should come with cloud computing.
The flip side of this argument is that not all organizations can give up control to third-party vendors. A proponent of private clouds would argue there are still significant benefits to private clouds in the sense that a private cloud is a way to centralize large installations of IT infrastructure in a highly virtualized manner while avoiding exposure to the unknowns of an outside cloud vendor.

 


Share:

In PowerShell, which of the following is not a standard way to accept command line parameters (arguments) into a function?

In PowerShell, which of the following is not a standard way to accept command line parameters (arguments) into a function?

  • function <name> { param( [<type>]$<arg> ) [...] }
  • function <name> ( [<type>]$<arg> ) { [...] }
  • function <name> { $Global:<arg> [...] }
  • function <name> { $arg[0]; $arg[1] [...] } 
In PowerShell, which of the following is not a standard way to accept command line parameters (arguments) into a function?

EXPLANATION

Parameters

Script Parameters / Arguments (for scripts, functions and script blocks)
Pass arguments to a script or cmdlet by separating them with spaces:

PS C:\> Get-ChildItem -Path $env:windir -Filter *.dll -Recurse
This can be made a little more readable by breaking up long lines with PowerShell’s escape character:
PS C:\> Get-ChildItem `
  -Path $env:windir `
  -Filter *.dll `
  -Recurse

To pass multiple arguments to a script you can splat them:
$myargs = @{
  Path = "$env:windir"
  filter = '*.dll
  Recurse = $true
}
Get-ChildItem @myargs
The above will be expanded to: Get-ChildItem -Path $env:windir -Filter *.dll -Recurse

$args

Within a script or function you can refer to unnamed arguments using the $args array, for example passing all the arguments through to a cmdlet. You can also refer to specific arguments by their position:
"First argument is " + $Args[0]
"Second argument is " + $Args[1]

So if you call the script above like ./demoscript.ps1 "Alpha" "Beta", it will return:
"First argument is Alpha
"Second argument is Beta


Param

To define arguments by name, use a param statement, which is simply a comma separated list of variables, optionally prefixed with a [data type] and/or with = default values.
If used, the param statement MUST be the first thing in your script or function:
param (
    [string]$price = 100, 
    [string]$ComputerName = $env:computername,    
    [string]$username = $(throw "-username is required."),
    [string]$password = $( Read-Host -asSecureString "Input password" ),
    [switch]$SaveData = $false
)
write-output "The price is $price"
write-output "The Computer Name is $ComputerName"
write-output "The True/False switch argument is $SaveData"
Calling this script, and setting the switch parameter -SaveData to $TRUE:
.\demo.ps1 -ComputerName "\\server64" -SaveData
or setting -SaveData to $FALSE:
.\demo.ps1 -ComputerName "\\server64" -SaveData:$false

Parameter Attributes

In an Advanced Function, the params statement block can also optionally define parameter attributes:
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] 
These affect the function parameters as follows:
Mandatory - Whether the parameter is mandatory or optional (the default)
ValueFromPipeline - Accept values via the pipeline, of the same type expected by the parameter or that can be converted to the type that the parameter is expecting.
ValueFromPipelineByPropertyName - Accept values via the pipeline of the same type expected by the parameter and which also must have the same name as the parameter accepting pipeline input.
An Advanced Function is one that contains either a [cmdletbinding()] attribute or the Parameter attribute, or both.
cmdletbinding adds several capabilities such as additional parameter checking, and the ability to easily use Write-Verbose.
A function with cmdletbinding will throw an error if unhandled parameter values appear on the command line.

Defaults in PowerShell 3.0 and above

In PowerShell 3.0 if an arguments default value is omitted, there is an implied default value of $true you can use this to shorten both params and parameter attributes, (n.b. leaving out the = $true in this way will prevent the script from running in PowerShell 1.0 or 2.0)
Param (
   [Parameter(ValueFromPipelineByPropertyName)]
   [string] $DemoParameter
)

Cmdlet Parameters

Almost every PowerShell cmdlet can accept one or more optional parameters which can be supplied on the command line in the form -Parameter_Name Parameter_Value
The name of the parameter is always preceded by a hyphen (-)

The Parameter_value often needs to be provided in a specific data type (e.g. string or integer)
To find these details use Get-Help -detailed cmdletName
In some cases, the Parameter_Name is implied and does not need to be explicitly included.
In syntax descriptions:
 [-Param] -- is optional 
  -Param  -- is required
If you exclude the Parameter Names you must ensure that the Parameter Values are listed in the correct order (assuming more than one value is being passed .)
Parameter Names will be ignored if contained in quotation marks.
Multiple values (for the same parameter) can be separated with commas.

Parameters for external commands

When calling a non-PowerShell command or CMD utility then the parameters won't follow any PowerShell conventions,
Generally any arguments to external commands should be surrounded in quotes if needed due to spaces/long filenames (just like the CMD shell) or if any part of the command uses characters that have a special meaning to PowerShell such as brackets ( ) or { } s
See the & CALL operator page for more ways to execute a command, script or function.
“Slow down and enjoy life. It's not only the scenery you miss by going too fast, you also miss the sense of where you are going and why” - Eddie Cantor
Related PowerShell Cmdlets:
help about_Functions_Advanced_Parameters

 

Share:

Which of the following command-line strings lists the mapped drives in Windows?

Which of the following command-line strings lists the mapped drives in Windows?

  • showdr
  • net use
  • show folder
  • drlocation 
Which of the following command-line strings lists the mapped drives in Windows?

EXPLANATION


The net use command is a Command Prompt command that's used to connect to, remove, and configure connections to shared resources, like mapped drives and network printers.
The net use command is one of many net commands like net send, net time, net user, net view, etc.

Net Use Command Availability

The net use command is available from within the Command Prompt in Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP, as well as in older versions of Windows and in Windows Server operating systems.
Recovery Console, the offline repair utility in Windows XP, also includes the net use command but it's not possible to use it within the tool.
The availability of certain net use command switches and other net use command syntax may differ from operating system to operating system.

Net Use Command Syntax

net use [{devicename | *}] [\\computername\sharename[\volume] [{password | *}]] [/user:[domainname\]username] [/user:[dotteddomainname\]username] [/user:[username@dotteddomainname] [/home {devicename | *} [{password | *}]] [/persistent:{yes | no}] [/smartcard] [/savecred] [/delete] [/help] [/?]
It will be important to know how to read command syntax if you're not sure how to interpret the net use command syntax as it's shown above or described in the table below.

Net Use Command Options
Option Explanation
net use Execute the net use command alone to show detailed information about currently mapped drives and devices.
devicename Use this option to specify the drive letter or printer port you want to map the network resource to. For a shared folder on the network, specify a drive letter from D: through Z:, and for a shared printer, LPT1: through LPT3:. Use * instead of specifying devicename to automatically assign the next available drive letter, starting with Z: and moving backward, for a mapped drive.
\\computername\sharename This specifies the name of the computer, computername, and the shared resource, sharename, like a shared folder or a shared printer connected to computername. If there are spaces anywhere here, be sure to put the entire path, slashes included, in quotes.
volume Use this option to specify the volume when connecting to a NetWare server.
password This is the password needed to access the shared resource on computername. You can choose to enter the password during the execution of the net use command by typing * instead of the actual password.
/user Use this net command option to specify a username to connect to the resource with. If you don't use /user, net use will attempt to connect to the network share or printer with your current username.
domainname Specify a different domain than the one you're on, assuming you're on one, with this option. Skip domainname if you're not on a domain or you want net use to use the one you're already on.
username Use this option with /user to specify the username to use to connect to the shared resource.
dotteddomainname This option specifies the fully qualified domain name where username exists.
/home This net use command option maps the current user's home directory to either the devicename drive letter or the next available drive letter with *.
/persistent:{yes | no} Use this option to control the persistence of connections created with the net use command. Choose yes to automatically restore created connections at the next login or choose no to limit the life of this connection to this session. You can shorten this switch to /p if you like.
/smartcard This switch tells the net use command to use the credentials present on the available smart card.
/savecred This option stores the password and user information for use next time you connect in this session or in all future sessions when used with /persistent:yes.
/delete This net use command is used to cancel a network connection. Use /delete with devicename to remove a specified connection or with * to remove all mapped drives and devices. This option can be shortened to /d.
/help Use this option, or the shortened /h, to display detailed help information for the net use command. Using this switch is the same as using the net help command with net use: net help use.
/? The standard help switch also works with the net use command but only displays the command syntax, not any detailed information about the command's options.











Share:

Popular Posts