Monday, February 8, 2010
Powershell Command R
-------------------
Thanks,
Pablo Picasso - "Computers are useless. They can only give you answers."
opps!! I forgot my basics...Keyboard Symbols
! exclamation mark
@ I just know it as the 'at' symbol
# hash
$ dollar (don't tell me you didn't know that one. ;-D )
% per cent
^ caret (I think that's the correct spelling and I think it's pronounced cah (as in cat) and then ray so cah-ray)
& ampersand
* asterisk
( left bracket
) right bracket
_ underscore
- hyphen
= equals
+ plus (bet you had to go to school to learn the last two - lol)
{ left parenthesis
} right parenthesis (these are also called "curly brackets")
[ forgotten
] also forgotten but it's the right one! I think they are just known as square brackets but do have a proper name.
| pipe - the picture on the key looks like two lines, one above the other.
\ backslash
: colon
; semi-colon
" inverted comma
' apostrophe
< left angled bracket or left chevron
> right angled bracket or right chevron
, comma
. fullstop
? question mark
/ slash
-------------------
Thanks,
Mike Ditka - "If God had wanted man to play soccer, he wouldn't have given us arms."
PowerShell: File cannot be loaded because the execution of scripts is disabled on this system error in PowerShell
File cannot be loaded because the execution of scripts is disabled on this system error in PowerShell
SOLUTION:
The reason for this error is the security setting on your pc that does not allow you to execute a script. This is the so-called Execution Policy. By default, the Execution Policy is set to Restricted. This setting means that you may not run any PS1 script at all.
An overview of the policy levels:
Restricted: Individual cmdlets can run, but not saved Powershell scripts. This is the default setting.
AllSigned: Scripts can run, but must have a digital signature even if written on the local computer. Prompts you before running scripts from trusted publishers.
RemoteSigned: Scripts written on the local computer do not need a digital signature, but any script downloaded from outside (email, IM, Internet) must have a signature to execute.
Unrestricted: Any script can run, but scripts downloaded from outside will run with a warning.
If you're working on a desktop and just experimenting with PowerShell, the best is to set the policy-level to Unrestricted. This allows you do everything with annoying security boundaries. Just be careful not to run every script you download from the internet :)
If you're working in a production environment and only want to run self-written scripts, the RemoteSigned level should be loosy enough.
To change the Execution Policy to Unrestricted, type the following command in Powershell
Set-ExecutionPolicy Unrestricted
To change the Execution Policy to RemoteSigned (to run your own scripts), type the following command in Powershell
Set-ExecutionPolicy RemoteSigned
If you have any question left, feel free to leave a comment. By choosing to be informed when someone posts a reply, you will immediately receive an email after someone replies
-------------------
Thanks,
ADST and AD Daily health Checks
Active Directory Snapshot Tool (ADST)
ADST tools is the one like MBSA it checks everything about AD healthchecks.
Below are the complete tools for AD health checks
Test |
Frequency | |
AD Convergence | Daily |
DCDiag – General | Daily |
FRS Convergence | Daily |
Performance Info | Daily |
Replication Status | Daily |
Account Policies | Weekly |
Backup Status | Weekly |
Database Info | Weekly |
DCDiag – DNS | Weekly |
DNSLint | Weekly |
DNS Information | Weekly |
Event Logs | Weekly |
Exchange DSAccess | Weekly |
GPOTool | Weekly |
IP Information | Weekly |
Large Groups | Weekly |
OS Information | Weekly |
Replication Configuration | Weekly |
Site Configuration | Weekly |
Subnet Information | Weekly |
SYSVOL Information | Weekly |
Time Configuration | Weekly |
WINS 1B and 1C | Weekly |
AD Object Count | Monthly |
Forest / Domain Information | Monthly |
Machine Account Info | Monthly |
Orphaned GPTs | Monthly |
Partition ACLs | Monthly |
Security Updates | Monthly |
Unlinked GPOs | Monthly |
User Account Info | Monthly |
Account Lockouts | As needed |
ADST Dependencies | As needed |
-------------------
Thanks,
Pablo Picasso - "Computers are useless. They can only give you answers."
VBSCRIPT FILE VERSION ON LIST OF SYSTEMS TO EXCEL
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "System Name"
objExcel.Cells(1, 2).Value = "Version"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\mshtml.dll'")
For Each objFile in colFiles
objExcel.Cells(intRow, 2).Value = objFile.Version
objExcel.Cells(intRow, 1).Value = strComputer
objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Next
loop
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range("B1")
objRange.Sort objRange,1,,,,,,1
' loop
MsgBox "Done"
''''''''''''''''''''''''''''''' THIS SCRIPT IS NOT WORKING AS EXPECTING IT IS OPENING MANY EXCEL FILES WITH CORRECT OUTPUT.. ANYWAY IT MIGHT USEFULL TO ME
-------------------
Thanks,
Mike Ditka - "If God had wanted man to play soccer, he wouldn't have given us arms."
VBSCRIPT FOR FILE VERSION CHECK
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\drivers\\tdx.sys'")
For Each objFile in colFiles
Wscript.Echo objFile.Version &" " & strComputer
'Wscript.Echo "Version: " & strComputer
Next
loop
-------------------
Thanks,
Marie von Ebner-Eschenbach - "Even a stopped clock is right twice a day."