Command/Powershell script to reset a network adapter

You can use WMI from within PowerShell to accomplish this. Assuming there is a network adapter who’s device name has Wireless in it, the series of commands might look something like the following: $adaptor = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like “*Wireless*”} $adaptor.Disable() $adaptor.Enable() Remember, if you’re running this with Window’s Vista, you may … Read more

How to save each line of text file as array through powershell

The Get-Content command returns each line from a text file as a separate string, so will give you an array (so long as you don’t use the -Raw parameter; which causes all lines to be combined to a single string). [string[]]$arrayFromFile = Get-Content -Path ‘C:\USER\Documents\Collections\collection.txt’ In his excellent answer, mklement0 gives a lot more detail … Read more

Is there a way to make certain functions “private” in a PowerShell script?

In fact, if you call a .ps1 file, by default any functions and variables declared within it are scoped privately within the script (this is referred to as “script scope”). Since you’re seeing both functions defined globally, I infer that you’re dot-sourcing SvcTest.ps1, i.e. invoking it like this PS> . <path>\SvcTest.ps1 rather than calling it … Read more

Find files on Windows modified after a given date using the command line

The forfiles command works without resorting to PowerShell. The article is here: Find files based on modified time Microsoft Technet documentation: forfiles For the example above: forfiles /P <dir> /S /D +12/07/2013 /P The starting path to search /S Recurse into sub-directories /D Date to search, the “+” means “greater than” or “since”

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)