Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Wednesday, March 20, 2013

Powershell execution of scripts is disabled on this system

Issue:-

First time when you launch PowerShell and try to run any PowerShell scripts file, it will not run and gives the below error. Here I am trying to run a simple ps script “directory.ps1” with Get-Chitditem cmdlet inside it.

"File C:\ZAid\Testing\Script.ps1 cannot be loaded because the execution of scripts is disabled on this system. "


When PowerShell is first installed the default execution policy is “Restricted.” This means PowerShell will not run scripts or configuration files. Here is a list of policy levels:

Tuesday, November 27, 2012

Monitor Disk Space

In the following script, you monitor the disk space on a server to let you know when it falls below 100000000 bytes. If the free space falls below 100000000, a message is echoed to the screen every 5 seconds.

Friday, October 5, 2012

To get Model String

For Drivers deployment , we need to find the exact Manufacturer and Model to deploy using SCCM. s We need to create WMI Query to install the Driver Package based on Make & Model.


Set objShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
strWinDir = objShell.ExpandEnvironmentStrings("%WinDir%")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each objItem In colItems
        Manufacturer = objItem.Manufacturer
        Model = objItem.Model
Next

strThisComputer = Manufacturer & " - " & Model

intRetVal = InputBox("Use model string below for Drivers.xml", "Get Make and Model", strThisComputer)

Monday, April 30, 2012

SCOM command line to remove Management Group Config


This is a command line option to remove a Management group configuration from an agent

MsiExec.exe /i \\path\MOMAgent.msi /norestart /qn /l*v %temp%\RemoveMG.log MANAGEMENT_GROUP=<OldManagementGroup> MANAGEMENT_GROUP_OPERATION=RemoveConfigGroup REINSTALL=ALL

Script to check CPU utilization for Processes

Below is the script to check the CPU utilization for every process running on a server
Save this as a .vbs file and then run it using cscript.

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

SCCM/MDT: WMI Script to check computer Make & Model

Below is the WMI script to check computer Make & Model, output of which can be used in SCCM/MDT for make & model based driver deployment query.

Hope, this will find a place in your requirement J.
Go to Start and open Run.
1.       WBEMTEST

Script to Verify Local administrator credential

One of our client came with very strange requirement. Their Security Policy is to change local administrator password for every 2 months, it should be different for all servers, they have to maintain excel sheet and send it to the Manager. Manager want to verify whether password has changed for all servers and it is according to the excel sheet which is sent to him. There are some hundreds of servers, so they want simple script which will do it for them.
We came with solution which uses PsTools to do this task. PsTools is the Microsoft toolkit which provide bunch of tool to do different task on the remote system. We used PsExec which can be used execute the command on remote system.

Friday, April 27, 2012

MDT: Deploy Windows 7 without DHCP

We came across a scenario at one of our esteemed clients where we needed to deploy Windows 7 on hundreds of machine without the DHCP environment. So all the clients had Static IP assigned to it. When system boots into WinPE it doesn’t get the IP. It is easy in NEW COMPUTER scenario as when the system boots up into WinPE you can assign the Static IP from Welcome screen. But in case of REFRESH scenario we don’t get the Welcome screen in MDT 2010. To achieve the above requirement i have done the customization in the Task Sequence with script as shown below.

Saturday, April 14, 2012

SCOM CPU Memory Disk Util SQL Scripts

Below are the scripts are to find SCOM CPU Memory Disk Utilization. Scripts need to be run on the Data warehouse DB.
Adjust the date to suite your requirements. The rest of the script remains the same

Tuesday, April 10, 2012

VBS Script to Verify If The Admin$ Share Exists On A List Of Machines

Before deploying SCCM Client to the client machine we need to confirm if Admin$ Share Exists. Instead of doing the same manually, we have created the script which you can use to test if the share exists on client machine or not. Hope it helps to automate your process!!!!

Create a text file created with the Computer Names.

Azure Policy support for remediating tags for existing resources

Use Azure policy to remediate tags for existing resources. https://azure.microsoft.com/en-us/updates/azure-provides-at-scale-tags-managem...