Advertisement
Guest User

Untitled

a guest
Feb 15th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. # Log file time stamp:
  2. $LogTime = Get-Date -Format "MM-dd-yyyy_hh-mm-ss"
  3. # Log file name:
  4. $LogFile = 'C:PSLogs'+"LOG_"+$LogTime+".log"
  5.  
  6. if(---)
  7. {
  8. ----
  9. ----
  10. "done" | Out-File $LogFile -Append -Force
  11. }
  12. else
  13. {
  14. "Unlucky!!" | Out-File $LogFile -Append -Force
  15. }
  16.  
  17. # Log file time stamp:
  18. $LogTime = Get-Date -Format "MM-dd-yyyy_hh-mm-ss"
  19. [xml] $var = Get-Content D:ScriptMgrSample.xml
  20. $ser = read-host "Enter the centre:"
  21.  
  22. # Log file name:
  23. $path = "C:Logs"
  24.  
  25. if([IO.Directory]::Exists($path))
  26. {
  27. #Do Nothing!!
  28. }
  29. else
  30. {
  31. New-Item -ItemType directory -Path C:PSLogs
  32. }
  33.  
  34. $LogFile = 'C:PSLogs'+$ser+$LogTime+".html"
  35. if (($sea=$var.detail.centre | where {$_.name -eq $ser}) -ne $null)
  36. {
  37. Write-Host "center:" $sea.name
  38. Write-Host "Servername:" $sea.servername
  39. Write-Host "ip:" $sea.ip
  40. Write-Host "Username:" $sea.uname
  41. Write-Host "Password:" $sea.pwd
  42. Write-Host "Database:" $sea.dbname
  43. "$LogTime Found" | Out-File $LogFile -Append -Force
  44. }
  45. else
  46. {
  47. write-host "not listed!!!"
  48. "$LogTime Not Found" | Out-File $LogFile -Append -Force
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement