Collect SCCM client log – For troubleshooting

On a client machine to troubleshoot issues related software/patch deployment (via SCCM), a set of information would be required from the respective machine. I have developed a powershell script LogCollection v1.0 to collect such required information from the reported machine. This might be useful for the needy. This script will perform following actions in the client on which it is…

0

Running the SCCM Client policy via a Package Deployment

Though the SCCM client re-run all the SCCM client policy at a respective interval, there would be some requirement where we need certain policies to be triggered explicitly. This can be done directly from the Configuration Manager client that is installed on the client machine, but still we ‘may’ need to have this in a script…

0

Sending email using Powershell script

   Below is a script that can be used to send email using Powershell.  function sendMail{      Write-Host “Sending Email”      #SMTP server name     $smtpServer = “smtp.xxxx.com”      #Creating a Mail object     $msg = new-object Net.Mail.MailMessage      #Creating SMTP server object     $smtp = new-object Net.Mail.SmtpClient($smtpServer)      #Email structure      $msg.From = “fromID@xxxx.com“     $msg.ReplyTo = “replyto@xxxx.com“    …

17

PreUpgradeCheck does not run

Issue: In some occasion while trying to run the PreUpgradeCheck command it throw below error: Pre-upgrade check cannot proceed because the current farm is not joined to a farm, or the farm configuration database is not responding. Resolution: This error is probably that you don’t have the sufficient privileges to run the command, so run…

0

Adding a new managed account in SharePoint 2010 using PowerShell

This is script to add a managed account programmatically using powershell. In this script we check if the account already exists if not then add it. Below are the variable that will hold the needed data for the creation of the managed account. $AppPoolAC: The account that needs to be added to Managed Account. $AppPoolACCred:…

0

Creating table using Powershell

Below is a sample script to create a datatable using powershell.$tabName = “SampleTable”#Create Table object$table = New-Object system.Data.DataTable “$tabName”#Define Columns$col1 = New-Object system.Data.DataColumn ColumnName1,([string])$col2 = New-Object system.Data.DataColumn ColumnName2,([string])#Add the Columns$table.columns.add($col1)$table.columns.add($col2)#Create a row$row = $table.NewRow()#Enter data in the row$row.ColumnName1 = “A” $row.ColumnName2 = “1” #Add the row to the table$table.Rows.Add($row)#Display the table$table | format-table -AutoSize #NOTE:…

1

Validate the existence of user account in AD using Powershell

This is a small script that is used to check if the given user account does exists in Active Directory. If you have a xml/csv/txt file with multiple user accounts to be checked then this script can be used with some modification to read the data from the file. The input data for the below…

4

How to add Active Directory module in PowerShell in Windows 7

If you are planning to run a Powershell script with Active Directory commandlets on a Win 7 machine or any other machine that DOES NOT have AD role then you need to do some preliminary steps as listed below.   Step1:   By default one can not import Active Directory module in Powershell in Windows…

18

Creating log files in Powershell scripts

I was working on a project in which I had to create a script to do some solution deployment, site creations etc., and while doing these the script shoul create log file to log entire process. This is a sample script which i worked out and could be useful to all needy. This script has…

0

Powershell script to generate an excel report to list the applications and patches installed

This is a Powershell script to create a report in excel listing all the applications and patches installed  in the local machine. The report will have following information: 1st sheet will have Application Name and Application Version. 2ns sheet will have KB and Description The script is attached as a file to this blog, please…

4