popunder new
Wednesday, March 20, 2013
Tuesday, January 29, 2013
PowerShell 3 quick switch to PowerShell 2
If you need to quickly switch to version 2 while you are in PowerShell 3 type the following.
PowerShell.exe -version 2
You will see the copyright info change to 2009 and if you type get-host it will display version 2.
To switch back to version 3 you can either close and re-open PowerShell or simply type in your current session
PowerShell.exe -version 3
Set PowerShell icon launch to default to run as Administrator
Many commands in PowerShell will not run unless they are run as an administrator. You can of coarse right click on the taskbar icon and choose the ‘Run as Administrator’ option. But if you prefer to have the icon or shortcut default to run PowerShell as Administrator then you can right click on it once, and choose the ‘Properties’ item.
In the window that pops up, near the bottom right of the window click the ‘Advanced’ button.
On the next (and last) screen, you will see a checkbox with ‘Run as administrator’. make sure that checkbox is selected, click ‘OK’, then ‘OK’ on the main Properties window to exit .
From now on out, when you click the PowerShell icon, it will run as administrator and you should see the Administrator prefix displayed in the PowerShell title bar.
Monday, January 28, 2013
Get memory configuration of all vm's on hyper-v server and output totext file
Works on Server 2012 with powershell 3
Get-VM | Get-VMMemory | out-file -filepath C:\VMMemory.txt
C:\VMMemory.txt
Get all vm’s on a hyper-v server and output to text file
Works on Server 2012 with powershell 3
Get-VM | Where-Object {$_.State -eq ‘Running’} | out-file -filepath C:VMrunning.txt
C:VMrunning.txt
Powershell 3 combo installer
The installer runs silently and installs both the dotNetFx40_Full_x86_x64.exe and either the Windows6.1-KB2506143-x86.msu or Windows6.1-KB2506143-x64.msu files. When the script completes a pop-up prompting for a reboot will be displayed.
After re-booting and launching powershell type get-host to display the version number.
Wednesday, December 12, 2012
List members of all local groups on a list of computers vbs script
Const ForAppending = 8
Const ForReading = 1
ServerCount = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\scripts\serverlist.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
strComputer = strNextLine
'WScript.Echo "Processing " & strComputer
ProcessGroups
ServerCount = ServerCount + 1
Loop
'WScript.Echo "Computers Processed " & ServerCount
'WScript.Quit
Sub ProcessGroups
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("c:\scripts\GroupInfo.txt", _
ForAppending, True)
objLogFile.writeline " "
objLogFile.writeline "***************** " & strComputer & " *****************"
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
For Each objGroup In colGroups
objLogFile.writeline objGroup.Name
For Each objUser in objGroup.Members
objLogFile.writeline vbTab & objUser.Name
Next
Next
objLogFile.Close
End Sub
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\scripts\GroupInfo.txt"