Posts

How to enable execution of PowerShell scripts

Image
PowerShell Execution Policy The PowerShell Execution Policy determines whether PowerShell scripts are allowed to run. By default, the Execution Policy is set to Restricted. If you try to run scripts under the Restricted policy, you will get error messages. In this tutorial, you will learn about the execution policies, how to enable execution of PowerShell scripts on machine. What is Execution Policy PowerShell's execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. This feature helps to prevent the execution of malicious scripts. The execution policy isn't a security system that restricts user actions. For example, users can easily bypass a policy by typing the script contents at the command line when they cannot run a script. Instead, the execution policy helps users to set basic rules and prevents them from violating those unintentionally. Execute PowerShell Script I have created a "sample.ps1...

How to create links to sections on the same page in HTML

Image
HTML Hyperlinks are used to navigate from one web page to another. We can also use same <a> anchor tag to jump between different sections of same web page. To know how to insert hyperlink to navigate within different page, go through  HTML Links . In this tutorial you will learn how to link one section to another section on a same web page. Internal Links In case of long pages, we can help users to explore page by using internal links without scrolling. User can jump between different sections of page on single click. Internal links/page jumps use the same <a>  tag and href attribute. Link provided as value of href attribute points to particular section of page. Syntax Page jumps are done by using the name attribute of the a element. suppose we need a link to the top of your page, you would add an anchor like this near the top of your document. <a name="name_attribute_value"></a> There doesn’t need to be anything between the opening and closing tags....

PowerShell String

Image
Introduction to String in PowerShell As we have already discussed that PowerShell is build  on .Net Framework. According to the .NET definition of  string – “A string is a sequential collection of characters  that is used to represent text”. The PowerShell string is simply an object of  System.String type. How to Define String Anything mentioned within single quote or double  quote considered as string in PowerShell. Only difference between the two is that strings in  double quote support string expansion, while a single  quote will only represent literal strings. Operations on String To find out what operation can be performed on string, Use Get-member command which will return all methods applicable to string. Length of String Length property will return the number of characters  in string.  Split Operations on String Split operation will divide string into multiple line from where  split character is present. Lets take our environment...

HTML Links

Image
In this tutorial, you will learn how to link one web page to another in HTML. Creating Links in HTML A link or hyperlink is a connection from one web resource to another. Links allow users to move seamlessly from one page to another. A link has two ends, called anchors. The link starts at the source anchor and points to the destination anchor, which may be any web resource, for example, an image, an audio or video clip, a PDF file, an HTML document or an element within the document itself. HTML Link Syntax Links are specified in HTML using the <a> tag ie anchor tag. It is paired and inline tag. A link or hyperlink could be a word, group of words, or image. <a href="url">Link text</a> Anything between the opening <a> tag and the closing </a> tag becomes the part of the link that the user sees and clicks in a browser. The most important attribute of the <a>  tag is the href attribute, which indicates the link's destination. It's value...

PowerShell Hashtable

Image
Hashtable in PowerShell PowerShell Hashtable is a compact data structure that stores key/value pairs in a hash table. For example, it may contain student’s roll number as key and their name as value. A key/value pair is essentially a set of two elements that are related in some manner. How to create Hashtable Just like array, hashtable can also be created in  Multiple ways. Begin the hash table with an at sign (@). Enclose the hash table in braces ({}). It will create an empty hashtable for you. You can add Data in hashtable using add method. 3. You can also add keys and values to a hashtable when you create it. For example, the following statement creates a hash table with three keys. Use an equal sign (=) to separate each key from its value. Use a semicolon (;) or a line break to separate the key/value pairs. Keys that contains spaces must be enclosed in quotation marks.  Strings as values must be in quotation marks, even if they do not include spaces. If you want to main...

PowerShell Array

Image
  Array in PowerShell The array is a type of data structure that can be used to  store a collection of items, the collection of items can  be either of the same datatype or different.  The elements in an array can be accessed using  the index. The index of the array usually starts at 0 just  like other programming languages, so to access the first element, use index [0].  Define Array in PowerShell Array in PowerShell can be defined in multiple  ways. To create and initialize an array, assign comma separated multiple values to a variable.  Pass values to variable within bracket  beginning with @ like $var = @() When no data type is specified, PowerShell creates each array as an object array (System.Object[]).      3. We can create array to hold value of specific type also, like below How to access an Array We can refer to an array by using its variable name. To display all the elements in the array, type the arra...