Friday, August 10, 2018

Run Powershell Script on Windows 10

Executing PowerShell script is always easy on Windows but when it comes to Windows 10, it a little bit tricky and need additional attention.

On Windows 10, have different Execution Policies. 

Detailed docs can we found on Microsoft Docs 


The PowerShell script execution policies enable you to determine which Windows PowerShell scripts (if any) will be allowed to run on your computer. Windows PowerShell has four different execution policies:

Execution Policy
Description
Restricted
No PowerShell scripts can be run. Windows PowerShell can be used only in interactive mode. This means that you can only run individual commands. You can't run scripts under this policy, regardless of where the scripts came from (local or downloaded) and whether they are signed.
AllSigned
Only PowerShell scripts signed by a trusted publisher can be run. When you attempt to run a signed script, you'll receive a prompt asking you to confirm that you trust the publisher.
RemoteSigned
Downloaded PowerShell scripts must be signed by a trusted publisher before they can be run. Scripts that you run from the local computer don't need to be signed. There are no prompts when you attempt to run a script.
Unrestricted
No restrictions; all PowerShell scripts can be run.
Undefined(default)
No execution policy has been set.

You can set an execution policy that is effective only in a particular scope.

By default or if you are getting error to execute powershell Sctipt as below then you need to setup execution policy to unrestricted or something like that as per need.

File C:\Scripts\testScript.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170



To Run PowerShell script just select unrestricted scope for current user

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force -Verbose





Saturday, April 8, 2017

HP Pavilion X360 Wireless Issue Solved

I have got a new HP Pavilion 13 x360 and installed Ubuntu 14.04 and I'm having issues with wireless. I've  got many solution however nothing worked for me.

One of the solution worked, so keeping it on my blog so that others can take advantage of it, here is the info of hardware as well as the solution.

Network Hardware Info:
sudo lshw -C network
description: Wireless interface
product:
Wireless 3165
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:01:00.0
logical name: wlan0
version: 81
serial: 84:ef:18:8b:89:1d
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=4.4.0-31-generic firmware=16.242414.0 ip=192.168.1.100 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn
resources: irq:280 memory:b1400000-b1401fff


Issue with firmware, Need to download it from web
Please download this to your desktop

https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7265-ucode-25.17.12.0.tgz
Right-click it and select 'Extract Here.'
Now, open Terminal and guide to the extracted folder, Run below commands

cd ~/Desktop/iwlwifi-7265-ucode-25.17.12.0
sudo cp iwlwifi-7265D-12.ucode /lib/firmware/iwlwifi-3165-9.ucode
sudo cp iwlwifi-7265-12.ucode  /lib/firmware/iwlwifi-3165-12.ucode
After all this, just blacklist acer-wmi to ignore loading of acer-wmi and hp-wmi.
sudo -i
modprobe -r acer-wmi
echo "blacklist
acer-wmi"  >>  /etc/modprobe.d/blacklist.conf
exit
And @ last reboot system.
I hope this will work for all

Monday, July 29, 2013

Install and Configure SNMP on Ubuntu


Installation of SNMP service on Ubuntu  is little different in comparison to red-hat base systems. There are simple steps to install and configure but first important thing is which package is equivalent to which package in Debian Repository, there are two packages named snmp and snmpd. snmp is the client tools and snmpd is server.
so lets start the installation

sudo apt-get install snmpd snmp

Only by this snmp will be installed on the system, now its time to configure it.

Configuration
Now Rename the Original SNMPD configuration file

sudo mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.org

then create new configuration file

sudo vim.tiny /etc/snmp/snmpd.conf

and copy this content to that file

rocommunity  public
syslocation  "India"
syscontact  dexterdgeek@gmail.com


Make snmpd use the newly created file and make it listen to all interfaces:

Edit /etc/default/snmpd

Change from:
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'

To:
# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'

and restart snmpd

sudo /etc/init.d/snmpd restart


Test
Do a snmpwalk from another host against your newly configured host.

snmpwalk -v2c -c public 127.0.0.1

Yes it works!!

Tuesday, July 23, 2013

Monitring Machine


From last fewdays , i was tying to configure a Linux system to monitor my Lab Network and services. There is not any much information available on net. There are few networking tools avalable, so I thought to give them a try and here are tehe details fo them.
I tried these three tools:
1. MRTG
2. Munin
3. Nagios

The Multi Router Traffic Grapher, or just simply MRTG is free s/w for monitoring and measuring the traffic load on networklinks. It allows the user to see traffic load on a network over time in graphical form.MRTG uses the Simple Network Management Protocol (SNMP) to send requests with two object identifiers (OIDs) to a device. The device, which must be SNMP-enabled, will have a management information base (MIB) to look up the OIDs specified.

Munin is a networked resource monitoring tool that can help analyze resource trends and "what just happened to kill our performance?" problems. Munin presents output in graphs through a web interface.

Nagios is an open source computer system monitoring, network monitoring and infrastructure monitoring software application. Nagios offers monitoring and alerting services for servers, switches, applications, and services. It alerts the users when things go wrong and alerts them a second time when the problem has been resolved.

I installed this on Ubuntu 12.04. Installation and Configuration steps are in my others posts.
Source: Wikipedia

Friday, November 18, 2011

Upgrade to new release Fedora 16 (Verne)


To upgrade latest version of the Fedora Linux operating system simple process is here which provide update from the older versions of Fedora to Fedora 16

Open the Terminal and install the tool preupgrade by 
        
    yum -y install preupgrade

After installing this tool start it from terminal by using this command 

   preupgrade

then simply follow the instruction

Apply


Forward

After click Forward tool will download the required metadata for upgrade to Fedora 16,
after this reboot the system and complete the installation.



Njoy Fedora 16(VERNE)


Saturday, September 3, 2011

Install Linux and Windows together




Install Fedora and Windows on the same machine 

For those who are using windows and wants to move to Linux, and also for those who wants to make a dual boot, the first question that arises is "can we install windows and linux together" and the answer is YES, you can install linux and windows on the same machine, we call it "Dual Boot". 
The steps for making the machine dual boot is given below, remember one thing, install windows first and then install linux to avoid trouble.


First you need to understand the some basic terms about the file system


    In an hard disk you can only make 4 primary partition (extended partition is included and treated as a primary partition, the partitions inside the exteneded partitions are excluded) So there is an option of a primary and extended partition.


    Windows only understand the NTFS and FAT partition while Linux understand all the partition (you can create a extX partition and put your data there so that others can not see it on windows and you will get a secure partition).


    For installing the Linux, Linux need some specific partition(swap, ext4 with mount point / and /boot).


Now after understanding this terms, time to start the Installation before this you need the Windows CD/DVD and the Linux CD/DVD to install the OS on your machine.


For the Fresh hard disk installation


Firstly install the windows in your machine, during the partition time just create the one partition of NTFS with the minimum drive size as per your windows version


Windows 98/XP 7 GB


Windows vista 10 GB


Windows 7 13 GB


And specially don't do any other partition here.




Now time to install the Linux with your Windows, so we take the example of Ubuntu or Fedora


nearly all the Linux contain the same type of partition table


Boot the System with the boot-able media of Ubuntu or Fedora


and at the time of partition (i.e. In partition table) seems one NTFS partition of windows and the rest is allocated space, follow the steps mention here


    Make the whole space Extended


    Now make the partion in extended space


    1 Partition Type swap with 1 GB(40% of your RAM size)


    2 Next one partition Type ext4 and the Mount Point /boot and the size will be 500 MB (if you are installing your third os after installing windows and linux then you can skip the step of formating the boot partition just use it as it is)


    3 And the third one is also the Ext4 type but with the mount type / with size minimum 20 GB space.


    And in the rest of space make the partion as per your wish but with the type NTFS because if you use something else it will not be accessible in Windows


    Complete the Installation process and Njoy the windows and Linux on the same machine.


    For switching between the windows and Linux, when you start your machine select the as per your required OS form the boot loader.
And Njoy your OS.

Sunday, May 29, 2011

Change the GRUB Menu Timeout on Fedora 14, Fedora 15

Change the GRUB Menu Timeout on Fedora 14, Fedora 15

When your system boots, you will see the GRUB menu, or if you’ve enabled the menu to show by default. The only issue for this is that the default timeout. So you may want to change this timeout. Increase or Decrease the time,both are simple.

Open up the /boot/grub/grub.conf file in any text editor. For this you need Super User Permission
i am using Gedit

   #gedit /boot/grub/grub.conf

Now find the section:

    timeout=0

and now replace the 0. The timeout value is in seconds so replace it some other value
as i want it for 5 seconds, so i used

     timeout=5

And save the file, and when you reboot you will have that many seconds to choose the menu item you want.