/bundles/itninjaweb/img/Breadcrumb_cap_w.png

Blog Posts tagged with PowerShell

Ask a question

Verify When Windows Password was Changed

In our environment our user account group creates accounts using Novell eDirectory.We currently sync from eDirectory to our domain, but not the other way.We sometimes run into an issue when a user changes their password using their machine instead of a link provided that changes it in eDirectory. This causes issues with other shared sites were passwords are not synced up.

I've seen tools that will do this, but were not supported in Win 7 x64. To assist in troubleshooting I created a powershell script that will prompt for user ID, and it will return when the password was last changed on our domain. This was created from a variety of different Google searches with a few modifications to meet our needs. I thought I would share just in case anyone else has a similar wacky environment.

$user = read-host "Enter User ID"
$searcher=New-Object DirectoryServices.DirectorySearcher
$searcher.Filter="(&(samaccountname=$user))"
$results=$searcher.findone()
$changedtime = [datetime]::fromfiletime($results.properties.pwdlastset[0])
$c = "The user, $user has changed password last time at $changedtime"
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show($c)

 

 

After prompted for User ID this script will return a time stamp of when that password was last changed.

View comments (1)

Get System Model

I have recently changed from an all Dell shop to an all Lenovo shop. I've gotten used to the model under system inventory being the actual model of the machine. With Lenovo I get a combination of seven digits. This is not a huge deal. When searching for drivers I can enter this number and it will find the drivers I need on their site. 

 

To resolve this I created a custom inventory rule with the information below. This will get the system model on Lenovo machines.

ShellCommandTextReturn(powershell Get-WmiObject Win32_ComputerSystemProduct | Select Version)

 

After the machine inventories this will now place a new field under custom inventory.

 

 

 

 

 



 

Be the first to comment

Windows 8 Mapping Network Drive

I recently ran into an issue where I could not map network drives to our SAN. Mapping between machines worked just fine.

When using UNC paths I recieved "an extended error has occured".

When using NET USE I recieved "system error 2148073478 has occured".


Solution:

If you run Powershell from your Win 8 machine and run the following command: 

Set-SmbClientConfiguration -RequireSecuritySignature $true

When prompted enter "Y". After a reboot all of my usual drives are now mapped. 

View comments (1)

Powershell Speaks

I found this at http://powershell.com/cs/blogs/tips/archive/2012/02/20/make-powershell-speak.aspx. I haven't seen it on here. This could get pretty interesting. 

I've added this to the end of a few scripts that I have. Users think their computers are magical.


Add-Type -AssemblyName System.Speech
$synthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
$synthesizer.Speak('Installation Complete. Please reboot at your earliest convenience!')


View comments (3)

Gather Windows Event logs with PowerShell

1. Create a text file

2. Paste the following command in:

Get-Eventlog -LogName application -EntryType Error,Warning | Export-csv application_logs.csv | Get-Eventlog -LogName System -EntryType Error,Warning | Export-Clixml system_logs.csv

3. Save this file as windows_event_logs_dumper.ps1

When this script is ran, it pulls all of the application and system event logs, where the -EntryType is warning or error. 

Going a step further, you could write a kscript that runs this script, then do a step to "Upload a file" which will upload those logs to the computer inventory for each machine the script is ran on.

Be the first to comment
Showing 1 - 5 of 45 results

Top Contributors

Talk About OS Provisioning