Define an Operative System by dfhrf555fcg

VIEWS: 40 PAGES: 9

Define an Operative System

More Info
									Define an Operative System
What does an operative system do, and how does it do it?
Which elements compose the hardware and which characteristics do they have?
Explain the differences and objectives of each of the following programs: compilers,
assemblers, OS, OS commands, editors, device controllers, I/O routines.
Can you use an analogy between SO and government?
Try to describe briefly how the first systems were working befote the actual computers


Java scripts

Script 1: turning off windows

/========================================
// launches window to turn off your computer
//========================================
(new ActiveXObject("Shell.Application")).ShutdownWindows()



Script 2: inputting parameters through the command line

/========================================
// print all command line options
//========================================
var objArgs     = WScript.Arguments;
var argsNamed   = WScript.Arguments.Named;
var argsUnnamed = WScript.Arguments.Unnamed;


for (i = 0; i < objArgs.length; i++)
{
    WScript.Echo(objArgs(i));
}

WScript.Echo("There are " + argsNamed.length + " named arguments.");
WScript.Echo("There are " + argsUnnamed.length + " unnamed
arguments.");
Script 3: some network info

/========================================
// network info
//========================================

var WshNetwork = WScript.CreateObject("WScript.Network");

             var oDrives = WshNetwork.EnumNetworkDrives();

             var oPrinters = WshNetwork.EnumPrinterConnections();

             WScript.Echo("Domain = " + WshNetwork.UserDomain);

             WScript.Echo("Computer Name = " + WshNetwork.ComputerName);

             WScript.Echo("User Name = " + WshNetwork.UserName);

             WScript.Echo();

             WScript.Echo("Network drive mappings:");
             for(i=0; i<oDrives.Count(); i+=2){

            WScript.Echo("Drive " + oDrives.Item(i) + " = " +
oDrives.Item(i+1));

             }

Script 4: shell pop-up options

/========================================
// playing with WshShell
//========================================

var WshShell = WScript.CreateObject("WScript.Shell");

var BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This
Question:", 4 + 32);

switch(BtnCode) {

    case 6:

         WScript.Echo("Glad to hear you feel alright.");

         break;

    case 7:

         WScript.Echo("Hope you're feeling better soon.");

         break;

    case -1:

         WScript.Echo("Is there anybody out there?");

         break;

}


Visual Basic scripts

Script 1: copying a file

'Copy a File

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "k:\movies\The Wicker Man.avi" , "k:\",
OverwriteExisting


'Copy a Set of Files

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\*.txt" , "D:\Archive\" , OverwriteExisting
Script 2: copying several files of a kind

'Copy a Set of Files

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "K:\movies\*.srt" , "K:\" , OverwriteExisting


Script 3: deleting a file

'Delete a File

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\FSO\ScriptLog.txt")


Script 4: moving a file

'Move a File

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\examplefolder\example.log" , "D:\folderdestiny"


Scripts 5: create a folder

'Create a Folder

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:\FSO")


Script 6: move a folder

'Move a Folder

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Scripts" , "M:\helpdesk\management"


Script 6: delete a folder

'Delete a Folder

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")

Set colFolders = objWMIService.ExecQuery _
    ("Select * from Win32_Directory where Name = 'c:\\Scripts'")

For Each objFolder in colFolders
    errResults = objFolder.Delete
Next
Script 6: Create a Sample Microsoft PowerPoint Presentation!


'Create a Sample Microsoft PowerPoint Presentation!

Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
objPresentation.ApplyTemplate("C:\Program Files\Microsoft
Office\Templates\Presentation Designs\Globe.pot")

'check that path is correct!!!!!!!!

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * From
Win32_Process")

For Each objProcess in colProcesses
    Set objSlide = objPresentation.Slides.Add(1,2)
    Set objShapes = objSlide.Shapes

     Set objTitle = objShapes.Item("Rectangle 2")
     objTitle.TextFrame.TextRange.Text = objProcess.Name

    strText = "Working set size: " & objProcess.WorkingSetSize &
vbCrLf
    strText = strText & "Priority: " & objProcess.Priority & vbCrLf
    strText = strText & "Thread count: " & objProcess.ThreadCount &
vbCrLf

    Set objTitle = objShapes.Item("Rectangle 3")
    objTitle.TextFrame.TextRange.Text = strText
Next

'objPresentation.SaveAs("k:\Process.ppt")
'objPresentation.Close
'objPPT.Quit


Script 6: Create and Save a Word Document and exit word!


'Create and Save a Word Document and exit word

Set objWord = CreateObject("Word.Application")
objWord.Caption = "Test Caption"
objWord.Visible = True

Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

objSelection.Font.Name = "Arial"
objSelection.Font.Size = "18"
objSelection.TypeText "Network Adapter Report"
objSelection.TypeParagraph()

objSelection.Font.Size = "14"
objSelection.TypeText "" & Date()
objSelection.TypeParagraph()
objSelection.TypeParagraph()

objSelection.Font.Size = "10"

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration")

For Each objItem in colItems

    objSelection.Font.Bold = True
    objSelection.TypeText "ARP Always Source Route: "
    objSelection.Font.Bold = False
    objSelection.TypeText "" & objItem.ArpAlwaysSourceRoute
    objSelection.TypeParagraph()

    objSelection.Font.Bold = True
    objSelection.TypeText "ARP Use EtherSNAP: "
    objSelection.Font.Bold = False
    objSelection.TypeText "" & objItem.ArpUseEtherSNAP
    objSelection.TypeParagraph()

    objSelection.Font.Bold = True
    objSelection.TypeText "Caption: "
    objSelection.Font.Bold = False
    objSelection.TypeText "" & objItem.Caption
    objSelection.TypeParagraph()

    objSelection.Font.Bold = True
    objSelection.TypeText "Database Path: "
    objSelection.Font.Bold = False
    objSelection.TypeText ""   & objItem.DatabasePath
    objSelection.TypeParagraph()

    objSelection.Font.Bold = True
    objSelection.TypeText "Dead GW Detection Enabled: "
    objSelection.Font.Bold = False
    objSelection.TypeText ""   & objItem.DeadGWDetectEnabled
    objSelection.TypeParagraph()

    objSelection.Font.Bold = True
    objSelection.TypeText "Default TOS: "
    objSelection.Font.Bold = False
    objSelection.TypeText "" & objItem.DefaultTOS
    objSelection.TypeParagraph()

Next

'objDoc.SaveAs("k:\testdoc.doc")
objWord.Quit
Managing your OS

(For Windows 2000/XP)



Tip 1 – using CMD commands

In case you use DOS a lot, maybe you can find yourself frequently having more than
one DOS CMD window open at once. Perhaps you'll have one window for for
debugging a batch file, one for doing basic tasks such as displaying directories, etc.
and another one to check network settings. If so, it can get very puzzling navigating
between the different DOS windows because each of their similar titles. If you'd like,
you can change the titles of a DOS window so you can easily see what tasks you are
performing in each window.

To change the title of a Windows 2000 command prompt window, just enter in the
TITLE command, followed by your desired window title. For example, to name a
DOS window "Debugging Window", just enter the following command at a DOS
CMD prompt:

TITLE PINGS window

To go further and get a list of the available DOS commands in Windows, use the
following command at the Windows CMD prompt

HELP | MORE

with most commands you are able to type in HELP followed by the command to get
detailed help

For example:
HELP TIME, HELP MKDIR…

Also, if you want to execute another command just in case the first one fails, then
place the characters || between two DOS commands
An example:
copy filedontexists.tmp filenotcreated.bk || echo the file cannot be copied.



Tip 2 - Personalized Windows explorer

Windows Explorer can save a lot of time. But one feature that it has is proving to be
not such a good idea. This feature is that My Documents folder is shown by default
upon the launch of Explorer.

This default option could be based on the assumption that most of us work with
documents more than with any other type of files. This is more than probably true, but
equally there are many users out there who might not wish to see the contents of the
My Documents folder every time they open Windows Explorer. If that applies to you,
then pointing Explorer to open in a different folder or directory makes far more sense

To configure Explorer to show at launch, for example, the computer’s main drive
along with the folders bar, right-click on the Windows Explorer shortcut (Start/all
programs/accessories) and select Properties. This opens the Explorer Properties
windows. From the Shortcut tab, go to the Target box, and after EXPLORER.EXE,
add a space and then add /E to the target path. Click OK to apply the change.

When launched, Explorer will now default to the contents of the main directory of the
Windows 2000 drive, with the folders bar visible on the left. To view the main drive
without folder bars, in the Target box, add /N to the target path instead of /E.
Alternatively, to view the contents of My Computer with a drive selected and the
folders bar showing, in the Target box, after EXPLORER.EXE add a space and then
type /SELECT, /E, DRIVE:\ where “DRIVE” is the preferred drive; for example, C,
D, E, or F.



Tip 3 – Enhancing your bandwidth by managing group directives

Windows normally reserves 20% of its bandwidth for special applications; this
retention is caused by the QoS (quality of service) packets programmer, which is in
charge of optimizing local networks. But in the case of users that have only one PC at
home it can be better to disable this service in order to gain this 20% of unused
bandwidth.

The steps to follow are:

   1)   log in as an administrator
   2)   start/execute gpedit.msc (edit group directive)
   3)   machine configuration
   4)   Administrative profiles (patterns?)
   5)   Network
   6)   QoS programmer
   7)   Limit reserved bandwidth
    8) Enable and put 0%
    9) Apply and accept
    10) Go to network properties to check that QoS is activated



Tip 4- Editing the registry (something you don’t want to play with!)

Read this first before modifying the registry

Fiddling about in the registry can be pretty dangerous to your PC's health to say the
least. For a start you must remember that once you edit a registry key there is
basically no turning back as neither registry editor in Windows 2000 has an undo
feature.

Windows 2000 (in windows XP type regedit in start/execute) comes with two registry
editors for you to try to get to grips with, one is the good old Regedt32.exe and the
other is regedit32.exe an older version of regedit. We will cover what these two do in
a later tip but for now, here are a run down of rules we follow before making a
registry edit, we recommend that you do the same.

    1. Back up the registry before performing an edit as there is always the risk of a
       mistake.
    2. Remember the keys you change just incase you would like to change them
       back to the original settings.
    3. If you are worried about a setting you are thinking of changing, the best thing
       to do is not to change it unless it is vital to do so.

Example 1 Restricting Network Access to the Registry


In Windows 2000 (in XP slightly changes), only Administrators and Backup
Operators have default network access to the registry. If the access to the registry has
to be restricted, follow the steps listed below to create the following Registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg
Name: Description
Type: REG_SZ
Value: Registry Server

The Security permissions set on this key define what Users or Groups can connect to the system for
remote Registry access.

The default Windows installation defines this key and sets the Access Control List to restrict remote
registry access as follows:
Administrators have Full Control
The default configuration for Windows permits only Administrators remote access to the Registry.
Changes to this key to allow users remote registry access require a system reboot to take effect.

To create the registry key to restrict access to the registry:

1. Start Registry Editor (Regedt32.exe) and go to the following subkey:
   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
2. On the Edit menu, click Add Key.
3. Enter the following values:
    Key Name: SecurePipeServers
    Class: REG_SZ
4. Go to the following subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers
5. On the Edit menu, click Add Key.
6. Enter the following values:
    Key Name: winreg
    Class: REG_SZ
7. Go to the following subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg
8. On the Edit menu, click Add Value.
9. Enter the following values:
    Value Name: Description
    Data Type: REG_SZ
    String: Registry Server
10. Go to the following subkey.
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers\winreg
11. Select "winreg". Click Security and then click Permissions. Add users or groups to which you
    want to grant access.
12. Exit Registry Editor and restart Windows.
13. If you at a later stage want to change the list of users that can access the registry, repeat steps 10-12.




Bypassing the Access Restriction: You can add the account name that the service is
running under to the access list of the "winreg" key

Example 2 “optimizing memory”

In HKEY_LOCAL_MACHINE\system\currentcontrolset\control\session manager\ memory
management then by activating the disablepaging executive value to 1 (default is 0) executive
windows files will not be paged in the hard drive, this should make applications and the OS smoother
in general but it is only recoomended with 512MB RAM or more.

Example 3 show encrypt command in the conceptual menu

In HKEY_LOCAL_MACHINE\software\microsoft\windows\current version\ explorer\advanced then
by creating a DWORD value (variable double word) and setting it up to 1 , the option of encrypting a
file will appear in the right click properties of a file.

								
To top